- Home /
If two of the same objects spawn on top of each other, is it possible to destroy only one?
The problem I'm having is that I have two objects that are identical. Since they're a clone of a prefab, they have virtually the same attributes (besides a spawn ID). What makes this difficult is that I can't use one attribute to keep one and destroy the other (That I know of). The second problem is that one doesn't "enter" another one, they just spawn at the same second on top of each other. The only fix to this i've found is to destroy them both if that happens. I only want to destroy one though because then there won't be blank space in the game for a period of time, and I want to keep the two spawn system to add difficulty to the game.
For reference, this is what the game would kind of look like http://puu.sh/jsYMX/279778c623.jpg with only 3 specific spawns, instead of random numbers.
I don't know how to go about this in C# after trying to check for all these things that apparently can't be used since they're never entering another object.
Couldn't you add an attribute for position and check it before instantiating?