When giving a sprite a Custom Physics Shape, how do I delete a vertex?
Good evening,
When making a Custom Physics Shape for a sprite, how would I go about deleting a node?
Here's an example:
The sprite in question. It's a very simple grass tile edge.
How could I delete that node highlighted in blue? I've tried a few different things (hitting the delete key, control-clicking it, and every other key on my keyboard). Most of the guides I see either don't cover it, or they're for a different version of Unity.
All help is appreciated
https://redd.it/1hfyzpi
@r_Unity3D
Good evening,
When making a Custom Physics Shape for a sprite, how would I go about deleting a node?
Here's an example:
The sprite in question. It's a very simple grass tile edge.
How could I delete that node highlighted in blue? I've tried a few different things (hitting the delete key, control-clicking it, and every other key on my keyboard). Most of the guides I see either don't cover it, or they're for a different version of Unity.
All help is appreciated
https://redd.it/1hfyzpi
@r_Unity3D
I launched my first game about building a team with unique skeletons such as pop star, cook, pirate and many more to battle! It's completely free on Steam and play now!!
https://redd.it/1hg16to
@r_Unity3D
https://redd.it/1hg16to
@r_Unity3D
Trouble with spawning overlapped objects. Collider issue?
Hello!
I'm currently starting my first small hobby project, and I'm running into issues spawning room prefabs for my level generation. The original goal was to make a randomly generated series of rooms similar to Binding of Isaac. I initially followed this tutorial (Part 1: https://www.youtube.com/watch?v=qAf9axsyijY) but I never got it to work fully and have been troubleshooting since. I keep running into an issue where every 1 out of 20 rooms will be spawned on top of an existing room.
My current theory is that there's either an issue with the Spawn Destroyer's collider (an object that destroys room spawn points and overlapped rooms) or maybe an issue with Spawn Destroyers destroying each other first. I've also tried adding in various delays and limiting room spawns but it feels like the code is being treated as a suggestion rather than a rule.
Any suggestions would be greatly appreciated, but I may end up starting this part from scratch if I can't get it fixed.
My room spawn code and spawn destroyer code are listed below.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.SceneManagement;
using Unity.VisualScripting;
using System.Diagnostics.Tracing;
public class RoomSpawn : MonoBehaviour
{
public int openingDirection; // Which direction of this room needs a door
private RoomTemplate template; // Object containing all of the room prefabs
private int roomCount; // Max number of rooms (assigned per floor)
private int rand; // Random integer
private bool spawned = false; // Boolean to determine if a room has already spawned
public StairSpawner stairs; // Stair gameobjects
public int upstairsCount; // Number of upstairs objects per floor
public int downstairsCount; // Number of downstairs objects per floor
//public int upstairsCount_Main;
//public int downstairsCount_F1;
//public int upstairsCount_F1;
//public int downstairsCount_F2;
private int rand2;
private float counter;
private float waitTime;
// Start is called before the first frame update
void Start()
{
StartCoroutine(Waiter()); // This will stall for time based on the openingDirection
//Find the room template object that hosts all of the room game objects
template = GameObject.FindGameObjectWithTag("Rooms").GetComponent<RoomTemplate>();
// Find the stair spawner object that holds the stairs game object
stairs = GameObject.FindGameObjectWithTag("Stairs").GetComponent<StairSpawner>();
// Get the current scene for scene transition
//scene = SceneManager.GetActiveScene();
// Determine which floor we're on and set the roomCount equal to the number of rooms available on that floor
if (gameObject.transform.position.y < 500f)
{
roomCount = template.maxRooms_Main;
}
else if (gameObject.transform.position.y < 1500)
{
roomCount = template.maxRooms_F1;
}
else if (gameObject.transform.position.y < 2500)
{
roomCount = template.maxRooms_F2;
}
}
IEnumerator Waiter()
{
// This is a coroutine that will wait a time determined by the opening direction of the spawn point
counter = 0f;
waitTime = (0.1f / 3f) * (openingDirection - 1f) + 0.1f; // Calculates the wait time by scaling the opening direction to a range of [0.1s - 0.2s]
while (counter < waitTime)
{
counter += Time.deltaTime;
yield return null;
}
}
// Update is called once per frame
void FixedUpdate()
{
// Count the
Hello!
I'm currently starting my first small hobby project, and I'm running into issues spawning room prefabs for my level generation. The original goal was to make a randomly generated series of rooms similar to Binding of Isaac. I initially followed this tutorial (Part 1: https://www.youtube.com/watch?v=qAf9axsyijY) but I never got it to work fully and have been troubleshooting since. I keep running into an issue where every 1 out of 20 rooms will be spawned on top of an existing room.
My current theory is that there's either an issue with the Spawn Destroyer's collider (an object that destroys room spawn points and overlapped rooms) or maybe an issue with Spawn Destroyers destroying each other first. I've also tried adding in various delays and limiting room spawns but it feels like the code is being treated as a suggestion rather than a rule.
Any suggestions would be greatly appreciated, but I may end up starting this part from scratch if I can't get it fixed.
My room spawn code and spawn destroyer code are listed below.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.SceneManagement;
using Unity.VisualScripting;
using System.Diagnostics.Tracing;
public class RoomSpawn : MonoBehaviour
{
public int openingDirection; // Which direction of this room needs a door
private RoomTemplate template; // Object containing all of the room prefabs
private int roomCount; // Max number of rooms (assigned per floor)
private int rand; // Random integer
private bool spawned = false; // Boolean to determine if a room has already spawned
public StairSpawner stairs; // Stair gameobjects
public int upstairsCount; // Number of upstairs objects per floor
public int downstairsCount; // Number of downstairs objects per floor
//public int upstairsCount_Main;
//public int downstairsCount_F1;
//public int upstairsCount_F1;
//public int downstairsCount_F2;
private int rand2;
private float counter;
private float waitTime;
// Start is called before the first frame update
void Start()
{
StartCoroutine(Waiter()); // This will stall for time based on the openingDirection
//Find the room template object that hosts all of the room game objects
template = GameObject.FindGameObjectWithTag("Rooms").GetComponent<RoomTemplate>();
// Find the stair spawner object that holds the stairs game object
stairs = GameObject.FindGameObjectWithTag("Stairs").GetComponent<StairSpawner>();
// Get the current scene for scene transition
//scene = SceneManager.GetActiveScene();
// Determine which floor we're on and set the roomCount equal to the number of rooms available on that floor
if (gameObject.transform.position.y < 500f)
{
roomCount = template.maxRooms_Main;
}
else if (gameObject.transform.position.y < 1500)
{
roomCount = template.maxRooms_F1;
}
else if (gameObject.transform.position.y < 2500)
{
roomCount = template.maxRooms_F2;
}
}
IEnumerator Waiter()
{
// This is a coroutine that will wait a time determined by the opening direction of the spawn point
counter = 0f;
waitTime = (0.1f / 3f) * (openingDirection - 1f) + 0.1f; // Calculates the wait time by scaling the opening direction to a range of [0.1s - 0.2s]
while (counter < waitTime)
{
counter += Time.deltaTime;
yield return null;
}
}
// Update is called once per frame
void FixedUpdate()
{
// Count the
YouTube
RANDOM DUNGEON GENERATOR - EASY UNITY TUTORIAL - #1
In this beginner unity tutorial we will begin making a random dungeon generation !
We will first of all discuss what are random dungeon must and must not have and follow up by making our rooms and doing some programming with C# !
-----------------------…
We will first of all discuss what are random dungeon must and must not have and follow up by making our rooms and doing some programming with C# !
-----------------------…
number of available stair objects to spawn (refreshed each frame)
upstairsCount = stairs.upstairsCount;
downstairsCount = stairs.downstairsCount;
if (spawned == false && roomCount > 0 && counter >= waitTime)
{
// Subtract 1 from the total room counter and set roomCount to the new value
if (gameObject.transform.position.y < 500f)
{
template.maxRooms_Main--;
roomCount = template.maxRooms_Main;
}
else if (gameObject.transform.position.y < 1500)
{
template.maxRooms_F1--;
roomCount = template.maxRooms_F1;
}
else if (gameObject.transform.position.y < 2500)
{
template.maxRooms_F2--;
roomCount = template.maxRooms_F2;
}
//// If multiple rooms have subtracted from the total at the same time, and the total count is 0, destroy the game object and break out of the loop
//if (roomCount < 0)
//{
// Destroy(gameObject);
// return;
//}
//SpawnStairs
rand2 = Random.Range(0, 3);
if (rand2 == upstairsCount && upstairsCount > 0)
// if the random number is the same as the number of upstairs available (random chance) and the active scene is Main floor and there are available stairs
{
// Spawn an "Upstairs" object and decrease stair count by 1
Instantiate(stairs.upstairsObject, transform.position + new Vector3 (18,18,0), stairs.upstairsObject.transform.rotation);
GameObject.FindGameObjectWithTag("Stairs").GetComponent<StairSpawner>().upstairsCount--;
}
else if (rand2 == downstairsCount && downstairsCount > 0)
{
Instantiate(stairs.downstairsObject, transform.position + new Vector3(-18, -18, 0), stairs.downstairsObject.transform.rotation);
GameObject.FindGameObjectWithTag("Stairs").GetComponent<StairSpawner>().downstairsCount--;
}
// Spawn rooms
if (openingDirection == 1)
{
rand = Random.Range(0, template.bottomRooms.Length);
// If this is the last room, make it a room with one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.bottomRooms[rand], transform.position, template.bottomRooms[rand].transform.rotation);
roomCount--;
}
else if (openingDirection == 2)
{
rand = Random.Range(0, template.topRooms.Length);
// If this is the last room, make it a room with one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.topRooms[rand], transform.position, template.topRooms[rand].transform.rotation);
roomCount--;
}
else if (openingDirection == 3)
{
rand = Random.Range(0, template.leftRooms.Length);
// If this is the last room, make it a room with one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.leftRooms[rand], transform.position, template.leftRooms[rand].transform.rotation);
roomCount--;
}
else if (openingDirection == 4)
{
rand = Random.Range(0, template.rightRooms.Length);
// If this is the last room, make it a room with
upstairsCount = stairs.upstairsCount;
downstairsCount = stairs.downstairsCount;
if (spawned == false && roomCount > 0 && counter >= waitTime)
{
// Subtract 1 from the total room counter and set roomCount to the new value
if (gameObject.transform.position.y < 500f)
{
template.maxRooms_Main--;
roomCount = template.maxRooms_Main;
}
else if (gameObject.transform.position.y < 1500)
{
template.maxRooms_F1--;
roomCount = template.maxRooms_F1;
}
else if (gameObject.transform.position.y < 2500)
{
template.maxRooms_F2--;
roomCount = template.maxRooms_F2;
}
//// If multiple rooms have subtracted from the total at the same time, and the total count is 0, destroy the game object and break out of the loop
//if (roomCount < 0)
//{
// Destroy(gameObject);
// return;
//}
//SpawnStairs
rand2 = Random.Range(0, 3);
if (rand2 == upstairsCount && upstairsCount > 0)
// if the random number is the same as the number of upstairs available (random chance) and the active scene is Main floor and there are available stairs
{
// Spawn an "Upstairs" object and decrease stair count by 1
Instantiate(stairs.upstairsObject, transform.position + new Vector3 (18,18,0), stairs.upstairsObject.transform.rotation);
GameObject.FindGameObjectWithTag("Stairs").GetComponent<StairSpawner>().upstairsCount--;
}
else if (rand2 == downstairsCount && downstairsCount > 0)
{
Instantiate(stairs.downstairsObject, transform.position + new Vector3(-18, -18, 0), stairs.downstairsObject.transform.rotation);
GameObject.FindGameObjectWithTag("Stairs").GetComponent<StairSpawner>().downstairsCount--;
}
// Spawn rooms
if (openingDirection == 1)
{
rand = Random.Range(0, template.bottomRooms.Length);
// If this is the last room, make it a room with one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.bottomRooms[rand], transform.position, template.bottomRooms[rand].transform.rotation);
roomCount--;
}
else if (openingDirection == 2)
{
rand = Random.Range(0, template.topRooms.Length);
// If this is the last room, make it a room with one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.topRooms[rand], transform.position, template.topRooms[rand].transform.rotation);
roomCount--;
}
else if (openingDirection == 3)
{
rand = Random.Range(0, template.leftRooms.Length);
// If this is the last room, make it a room with one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.leftRooms[rand], transform.position, template.leftRooms[rand].transform.rotation);
roomCount--;
}
else if (openingDirection == 4)
{
rand = Random.Range(0, template.rightRooms.Length);
// If this is the last room, make it a room with
one door
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.rightRooms[rand], transform.position, template.rightRooms[rand].transform.rotation);
roomCount--;
}
spawned = true;
}
}
private void OnCollisionEnter2D(Collision2D collision)
{
// If there's a collision with any object (meaning a room or spawner is present), set Spawned to true to prevent a room from spawning
spawned = true;
// If it collides with a Spawn destroyer, destroy this spawn point
if (collision.gameObject.CompareTag("SpawnPoint") && collision.gameObject.name == "SpawnDestroy")
{
Destroy(gameObject);
}
// If it collides with a spawn point, compare opening direction values. The high value gets to spawn while the other is destroyed.
// If they have the same spawn point, something messed up and destroy them both.
// If it collides with anything else (like a floor) destroy this spawner
else if (collision.gameObject.CompareTag("SpawnPoint"))
{
if (collision.gameObject.GetComponent<RoomSpawn>().openingDirection > openingDirection)
{
spawned = true;
Destroy(gameObject);
}
else if (collision.gameObject.GetComponent<RoomSpawn>().openingDirection == openingDirection)
{
Destroy(collision.gameObject);
Destroy(gameObject);
}
else if (collision.gameObject.GetComponent<RoomSpawn>().openingDirection < openingDirection)
{
spawned = false;
Destroy(collision.gameObject);
}
else
{
Destroy(gameObject);
}
}
}
}
public class SpawnDestroyer : MonoBehaviour
{
private void Update()
{
//Destroy the "SpawnDestroy" after 3 sec so it doesn't destroy anything else
Invoke("DestroySelf", 2f);
}
private void OnTriggerEnter2D(Collider2D other)
{
// Destroys any trigger that touches the SpawnDestroyer
if (other.CompareTag("SpawnPoint"))
{
Destroy(other.gameObject);
}
}
private void DestroySelf()
{
// Destroy the Spawn Destroyer
Destroy(gameObject);
}
}
https://redd.it/1hg32d0
@r_Unity3D
if (roomCount < 2)
{
rand = 0;
}
Instantiate(template.rightRooms[rand], transform.position, template.rightRooms[rand].transform.rotation);
roomCount--;
}
spawned = true;
}
}
private void OnCollisionEnter2D(Collision2D collision)
{
// If there's a collision with any object (meaning a room or spawner is present), set Spawned to true to prevent a room from spawning
spawned = true;
// If it collides with a Spawn destroyer, destroy this spawn point
if (collision.gameObject.CompareTag("SpawnPoint") && collision.gameObject.name == "SpawnDestroy")
{
Destroy(gameObject);
}
// If it collides with a spawn point, compare opening direction values. The high value gets to spawn while the other is destroyed.
// If they have the same spawn point, something messed up and destroy them both.
// If it collides with anything else (like a floor) destroy this spawner
else if (collision.gameObject.CompareTag("SpawnPoint"))
{
if (collision.gameObject.GetComponent<RoomSpawn>().openingDirection > openingDirection)
{
spawned = true;
Destroy(gameObject);
}
else if (collision.gameObject.GetComponent<RoomSpawn>().openingDirection == openingDirection)
{
Destroy(collision.gameObject);
Destroy(gameObject);
}
else if (collision.gameObject.GetComponent<RoomSpawn>().openingDirection < openingDirection)
{
spawned = false;
Destroy(collision.gameObject);
}
else
{
Destroy(gameObject);
}
}
}
}
public class SpawnDestroyer : MonoBehaviour
{
private void Update()
{
//Destroy the "SpawnDestroy" after 3 sec so it doesn't destroy anything else
Invoke("DestroySelf", 2f);
}
private void OnTriggerEnter2D(Collider2D other)
{
// Destroys any trigger that touches the SpawnDestroyer
if (other.CompareTag("SpawnPoint"))
{
Destroy(other.gameObject);
}
}
private void DestroySelf()
{
// Destroy the Spawn Destroyer
Destroy(gameObject);
}
}
https://redd.it/1hg32d0
@r_Unity3D
Reddit
From the Unity2D community on Reddit: Trouble with spawning overlapped objects. Collider issue?
Explore this post and more from the Unity2D community
How to make a stretch at a point shader
Hi! I want to make a shader for grabbing a sprite at a point and it hanging down and stretching that point to the cursor. The problem is, I don't know how to code shaders. I was wondering if there is a existing shader or one I could use in the same way. Much appreciated thank you!
https://redd.it/1hg2z1n
@r_Unity3D
Hi! I want to make a shader for grabbing a sprite at a point and it hanging down and stretching that point to the cursor. The problem is, I don't know how to code shaders. I was wondering if there is a existing shader or one I could use in the same way. Much appreciated thank you!
https://redd.it/1hg2z1n
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
I just launched the demo for my base-builder, Final Outpost: Definitive Edition - run your town and defend it from hordes of zombies outside 🔫
https://www.youtube.com/watch?v=Svz2QZvz7CM
https://redd.it/1hg8qxd
@r_Unity3D
https://www.youtube.com/watch?v=Svz2QZvz7CM
https://redd.it/1hg8qxd
@r_Unity3D
YouTube
Final Outpost: Definitive Edition | Announcement Trailer (PC/Mac/Linux)
WISHLIST NOW ON STEAM : https://cutt.ly/WexvlktV
We are excited to announce that Final Outpost: Definitive Edition is coming soon to PC/Mac/Linux!
That’s right, it’s a Definitive Edition. That means we’ll be taking the original popular mobile strategy game…
We are excited to announce that Final Outpost: Definitive Edition is coming soon to PC/Mac/Linux!
That’s right, it’s a Definitive Edition. That means we’ll be taking the original popular mobile strategy game…
Spritesheet editor/extractor
With some more free time, I'd like to get back into learning C++ with the aims of exercising the grey matter and making some simple games. Some years ago I was using a program called darkFunction-Editor (github still there at https://github.com/darkFunction/darkFunction-Editor) to help me prepare spritesheets off the internet for use in a simple game. The developer (not active now) still has a youtube demo at https://www.youtube.com/watch?v=zMZa3TG58lQ.
In using this tool I was able to (amongst other features)...
1. Import a spritesheet and (if needed) set it's background colour to transparent
2. Automatically find each sprite on the sheet (placing a box around each), and allow for some fine tunning of the boxes.
3. Allow me to select and name different sets of single frames and animations on the sheet for inclusion in the final output xml file.
4. Pack the sprites into as small a space as possible.
5. Save the sprite sheet offset pointers as an xml file, whereby I was able to use the pugixml library to traverse the xml file, allowing me to select the sprite frames I needed for display.
Unfortunately, it looks like his main website is down so I can't get the installer, and my limited skills mean I don't know how to build the installer file from his github page.
Does anyone if the installer file can be rebuilt (and show me how) - or (maybe better) - can you suggest another tool to at least cover these same steps as above. The output file would still need to let me traverse the sprites on the actual sheet. Ideally, it would be nice to be able to cut out individual sprites and animations from one/more sheets and allow me to create my own custom spritesheet.
[Edit\] A bit more playing about with Google results and, oddly, I was pointed to a 'hidden' page on this same github location...
https://github.com/darkFunction/darkFunction-Editor/releases
The "/releases" page now gives me access to the installer .jar file, which I've just tested by successfully installing and running this utility on my system.
I'm sure there are other utilities that would perform the same functions and provide useful extras. Would be interested to know of any recommendations.
https://redd.it/1hg8een
@r_Unity3D
With some more free time, I'd like to get back into learning C++ with the aims of exercising the grey matter and making some simple games. Some years ago I was using a program called darkFunction-Editor (github still there at https://github.com/darkFunction/darkFunction-Editor) to help me prepare spritesheets off the internet for use in a simple game. The developer (not active now) still has a youtube demo at https://www.youtube.com/watch?v=zMZa3TG58lQ.
In using this tool I was able to (amongst other features)...
1. Import a spritesheet and (if needed) set it's background colour to transparent
2. Automatically find each sprite on the sheet (placing a box around each), and allow for some fine tunning of the boxes.
3. Allow me to select and name different sets of single frames and animations on the sheet for inclusion in the final output xml file.
4. Pack the sprites into as small a space as possible.
5. Save the sprite sheet offset pointers as an xml file, whereby I was able to use the pugixml library to traverse the xml file, allowing me to select the sprite frames I needed for display.
Unfortunately, it looks like his main website is down so I can't get the installer, and my limited skills mean I don't know how to build the installer file from his github page.
Does anyone if the installer file can be rebuilt (and show me how) - or (maybe better) - can you suggest another tool to at least cover these same steps as above. The output file would still need to let me traverse the sprites on the actual sheet. Ideally, it would be nice to be able to cut out individual sprites and animations from one/more sheets and allow me to create my own custom spritesheet.
[Edit\] A bit more playing about with Google results and, oddly, I was pointed to a 'hidden' page on this same github location...
https://github.com/darkFunction/darkFunction-Editor/releases
The "/releases" page now gives me access to the installer .jar file, which I've just tested by successfully installing and running this utility on my system.
I'm sure there are other utilities that would perform the same functions and provide useful extras. Would be interested to know of any recommendations.
https://redd.it/1hg8een
@r_Unity3D
GitHub
GitHub - darkFunction/darkFunction-Editor: A 2d sprite and animation studio for game developers
A 2d sprite and animation studio for game developers - darkFunction/darkFunction-Editor
The fast-paced roguelite ink action game InKing has been released! You can now download my first game for free on Steam! Splash ink, collect it, and obliterate your enemies!
https://redd.it/1hgas0j
@r_Unity3D
https://redd.it/1hgas0j
@r_Unity3D
Reddit
From the Unity2D community on Reddit: The fast-paced roguelite ink action game InKing has been released! You can now download my…
Explore this post and more from the Unity2D community
This media is not supported in your browser
VIEW IN TELEGRAM
Constantly see a deceptive mobile ad promoting an on-the-rails style shooter. Trying to make a game out of it, but the gameplay is turning out to not be that fun and way too easy
https://redd.it/1hgb03w
@r_Unity3D
https://redd.it/1hgb03w
@r_Unity3D
Character selection!
Can someone guide through about Recreating this kind of character selection system?
Where do i start from? i have no idea
Also, The sweet animations too
https://i.redd.it/y1wb828ldf7e1.gif
https://redd.it/1hgcqhn
@r_Unity3D
Can someone guide through about Recreating this kind of character selection system?
Where do i start from? i have no idea
Also, The sweet animations too
https://i.redd.it/y1wb828ldf7e1.gif
https://redd.it/1hgcqhn
@r_Unity3D
Look at those expressions! I'm so goddang proud of myself! I've designed and made this modular anime character from scratch and I love the result! You guys can try and bring me back Earth. Though, I'm not sure you can! :D (But in all seriousness: I'd be happy to get feedback, if you have the time.)
https://redd.it/1hg6qrz
@r_Unity3D
https://redd.it/1hg6qrz
@r_Unity3D
Reddit
From the Unity3D community on Reddit: Look at those expressions! I'm so goddang proud of myself! I've designed and made this modular…
Explore this post and more from the Unity3D community
This media is not supported in your browser
VIEW IN TELEGRAM
Added a simple sin based noscript and it works just like that, even for few connected parts!
https://redd.it/1hgg5j1
@r_Unity3D
https://redd.it/1hgg5j1
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
The animation of preparing dinner in my tavern management simulator.
https://redd.it/1hgi293
@r_Unity3D
https://redd.it/1hgi293
@r_Unity3D