- Home /
Tagged collision problem
Hi, all I am trying to have a prefab become active on my player whenever you collide with something tagged as Glock, I have tried writing a script for this but as soon as I start the game I get and error saying, 'UnityEngine.GameObject.Active' not found. Also nothing happens when I collide with something tagged as Glock. Can someone help me out?
var prefab : GameObject;
function Start (){
GameObject.Active = false;
}
function OnCollisionEnter(collision: Collision){
if(collision.gameObject.tag == "Glock")
Debug.Log("you have hit Glock");
GameObject.Active = true;
}
Comment
Answer by Omir · Mar 03, 2013 at 10:06 PM
You want to Basically activate something on collision
Well make prefab children of your player and then use something like
var prefab : GameObject;
make sure prefab is deactivated and Drag it into requirement block.
after that make a colider "
OnColisionEnter () {
GameObject.Active(True);
}
Thats It Your Done , I am not Programmer Though But Still Hope this Help and BTW check the API PROPERLY :)