Quantcast
Channel: Answers for "How do you detect collision with 2 objects and change a variable basd on that"
Browsing all 6 articles
Browse latest View live

Answer by FL

http://unitygems.com/mistakes1/ look at the third topic. Note than `collision.gameObject == "Cube1"` won't works, prefer to use `collision.gameObject.name == "Cube1"` or the Unity tag system.

View Article



Answer by Trond

You can't identify a gameObject with a string like "Cube1". A gameObject is a gameObject, and should normaly just be compared to other gameobjects to see if 2 gameObjects are refering to the same...

View Article

Answer by ozgurdugmeci

a late answer but: if it is 2d mode, it is supposed to be like : function OnCollisionEnter2D (coll : Collision2D) { ..... }

View Article

Answer by FL

http://unitygems.com/mistakes1/ look at the third topic. Note than `collision.gameObject == "Cube1"` won't works, prefer to use `collision.gameObject.name == "Cube1"` or the Unity tag system.

View Article

Answer by Trond

You can't identify a gameObject with a string like "Cube1". A gameObject is a gameObject, and should normaly just be compared to other gameobjects to see if 2 gameObjects are refering to the same...

View Article


Answer by ozgurdugmeci

a late answer but: if it is 2d mode, it is supposed to be like : function OnCollisionEnter2D (coll : Collision2D) { ..... }

View Article
Browsing all 6 articles
Browse latest View live




Latest Images