- Home /
Trigger to make game
Hopefully i can explain this correctly. Well, simply put, i'm trying to make an object appear when the player game piece enters its trigger. When the player piece enters the trigger, the special object's mesh renderer is checked back on. This is the script that I got from the main unity site:
function OnTriggerEnter (other : Collider) { Destroy(other.gameObject); }
I know this isn't the right script because i'm not trying the destroy anything, but the act of a player touching the trigger works, it's just tieing the trigger to the meshrenderer of the object. The object that is supposed to appear is called "chute1" and the trigger is called "triggerchute1." I could really use some help on what to put into this script please.
Answer by save · Nov 28, 2011 at 10:18 PM
Here's something that might get you in the right direction:
var chute1 : GameObject;
function Start () {
chute1 = GameObject.Find("chute1");
}
function OnTriggerEnter (other : Collider) {
if (!other.CompareTag("Player")) return;
chute1.GetComponent(MeshRenderer).enabled = true;
}