- Home /
Simple script...
Why is this not working?
static var hit = "";
function OnTriggerEnter(other : Collider){
if(other.CompareTag ("Blue")){ hit = "Blue"; Debug.Log("Blue"); }
if(other.CompareTag ("Red")){ hit = "Red"; Debug.Log("Red");
} }
I have it attached to a trigger object that follows the main camera around...
Answer by Statement · Mar 11, 2011 at 08:17 PM
If I remember correctly, trigger messages are not sent if it is the trigger that moves into something static. It has to be the other way around. I had a ton of headache with my characters that wouldn't fire the event once they got close to my player, if he was standing still.
So do you mean that I have to add the trigger to the portal?
I don't know if trigger/trigger collisions occur at all unless it has a kinematic rigidbody attached. See the bottom of http://unity3d.com/support/documentation/Components/class-BoxCollider.html
Your answer
Follow this Question
Related Questions
OnTriggerEnter2D not working, alternatives? 2 Answers
issues with on trigger enter and exit 1 Answer
Navmesh agent problem 1 Answer
OnTriggerEnter 1 Answer
Spawn Random Item On Trigger Enter 2 Answers