Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Collided Objects not destroyed

$
0
0
I have multiple objects and I want a character to collide with them. When it does, these objects are destroyed from the game. However, only the first object is detected and the rest do nothing when the character hits them. Here is the code: function OnCollisionEnter (col : Collision) { if (col.gameObject.name == "objectname") { Destroy(col.gameObject); } } Both are set as rigidbodies. I thought this would be simple but I am not really sure why its not working.

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>