- Home /
Checking for overlaping sprites in an array
Hi.
I have an array of sprites that are instantiated at random positions on the screen and I want to make sure that none of those sprites are on top of each other(since the player needs to press click them) I know I can use this somehow:
if (object1.renderer.bounds.Intersects(object2.renderer.bounds)) {
// Do some stuff
}
But I can't figure out how to implement it into a loop that checks it for all the sprites I have.
bump. Could really use some help from people who understands sprite bounds and calculating intersections with several objects
Answer by getyour411 · Mar 31, 2014 at 10:55 PM
http://answers.unity3d.com/questions/614080/checking-if-object-intersects.html
Take a look at OverlapSphere as your array feed
Your answer
Follow this Question
Related Questions
How do i change a sprite when another gameobject with the same prefab is colliding / is near 1 Answer
How do i change a sprite when another gameobject with the same prefab is colliding / is near 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Store multiple sprite in code C# 0 Answers