- Home /
Question by
HyperNovaGames · Mar 17, 2014 at 10:29 PM ·
ontriggerenterbulletrespawn
Enemy respawn once hit by bullet please help
I have a script that had worked before but not like this. I'm trying to re-spawn the enemy after it has been shot with a bullet. PLEASE HELP Code here
var startPosition : Transform;
function OnTriggerStay(theCollider : Collider)
{
if(theCollider.gameObject.tag == "Bullet")
theCollider.transform.position = startPosition.Position;
}
BTW the bullets collider is a trigger. PLEASE HELP
Comment
Best Answer
Answer by Jeremy2300 · Mar 17, 2014 at 10:56 PM
My guess is that it's your use of OnTriggerStay, try switching this to OnTriggerEnter. You could also check to insure the Bullet still has the tag "Bullet" attached to it as well just to be safe.
Also, looking at your code again, you're sending 'theCollider' to the startPosition. I believe you want to send you enemy to that position ('theCollider' in this case I'm guessing is the bullet, not the enemy).