- Home /
OnTriggerEnter and GUIText problem
Hey everyone,
Right now I'm having problems with the GUIText changing on trigger.Here is the code I'm using.
var _switch : GameObject;
function OnTriggerEnter (other : Collider) {
if(other.gameObject.name == _switch.name) {
noteTxt.text = "Press Space to activate!";
}
}
To me everything looks good but nothing happens. Can I have some help please. Thanks for your time.
Put this on line 4:
Debug.Log(other.name + ", " + other.tag);
This will tell you if your trigger is firing or not, and if it is firing, what it is hitting.
the code you have there is confir$$anonymous$$g a name match, witch will then display that text. RE$$anonymous$$E$$anonymous$$NER a trigger needs at least on Rigidbody. The other is just a collider not a trigger. This looks to be an inspector component issue, have you looked over it?
Your answer
Follow this Question
Related Questions
Collision Detection without a RigidBody 2 Answers
Collision not detected 3 Answers
Collision problem in C# 4 Answers
OnTrigger event when colliders are already touching eachother 1 Answer
2 objects collide, need to destroy one 2 Answers