- Home /
please help
i am trying to make a script that deletes the object its attached to when your player touches it but it does nothing here's my script
*var delslf = false;
var target : Transform;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Player")
{
delslf = true;
}
}
function update ()
{
if (delslf);
Destroy(target);
}*
please help
Add a Debug.Log to make sure OnControllerColliderHit is been called.
Please format your code and use question titles that are meaningful.
Answer by Montraydavis · Oct 26, 2012 at 01:17 AM
Well, it probably has something to do with OnControllerColliderHit, and the way your colliders are setup .
Set your collider as trigger, and use OnTriggerEnter
Your answer
Follow this Question
Related Questions
trouble adding script to clone object 1 Answer
How do you create a "collect" objection that corresponds with the enemy behavior in C#? 1 Answer
getting the object that the running script is attached to 1 Answer
Script stops working when switching to Android 1 Answer
reseting rotation of objects? 0 Answers