Hey, geys i am making a game so that when a ball hit the coin it disappears
i tried everything to work but i cant get it to work.
P.S: i changed the tag to “Coin” and the code is in javascript . I can change it if you want
function OnTriggerEnter(node : Collider){ if(node.gameObject.tag == "Coin") { Destroy(node.gameObject); } }
plz i need your help since i don’t want to give up on unity
This is really a very common question, and the answer is always the same:
First, watch https://unity3d.com/learn/tutorials/modules/beginner/physics/colliders-as-triggers
Have you attached colliders to your objects? Marked as triggers? With rigidbodies? Are you moving them correctly? Have you attached the script to the gameobject? Is it testing the right tag? Have you used Debug.Log to test whether the trigger is being called at all?