- Home /
Trigger problems...
Hello. This is part of my script that will handle collisions. Whenever the object that this script is attached to collides with an object with the name "Basic" I want something to happen. I have an object named "Basic" with a trigger, and nothing happens (the console reads "MissingMethodException: Method not found: 'UnityEngine.BoxCollider.Find'."). What is wrong?
function OnTriggerEnter (other : Collider){ if (other.collider.Find ("Basic")) {PHP-=5;}}
Comment
Best Answer
Answer by efge · Dec 28, 2010 at 11:51 PM
When you want to compare the name of the collider you could use other.collider.name.
if (other.collider.name == "Basic")
...
It is still not working. I am getting no errors, but nothing is happening (in this case, 5 is not being subtracted from the variable PHP).
Your answer
![](https://koobas.hobune.stream/wayback/20220613093002im_/https://answers.unity.com/themes/thub/images/avi.jpg)