Hello. I am trying to create some zombies for a game I am making, but I have been having some difficulties. I am following this tutorial here (Unity 3D part11, Kill the Zombies - YouTube)
This is the script. The zombie just doesn’t disappear, even though I did exactly what the guy said.
//JavaScript
var AudioClip;
function OnTriggerEnter( other : Collider ){
Debug.Log("OnTriggerEnter() was called");
if(other.tag == "zombie")
{
audio.Play();
Debug.Log("Kill the Zombie");
Destroy(other.gameObject);
}
}
Which debug statements are showing up in the console?
If OnTriggerEnter does not appear then the problem is related to the collision. One of the GameObjects involved must have a rigidbody, one of the GameObjects involved must have a collider that is not a trigger.
If Kill the Zombie does not appear then your zombie doesn’t have the correct tag. Capitalisation is important here.
“OnTriggerEnter() was called
UnityEngine.Debug:Log(Object)
zombie_kill:OnTriggerEnter(Collider) (at Assets/zombie_kill.js:5)”
take a look at the pictures, please. I will show u the inspector of the zombie and the fireball.[30799-screen+shot+2014-08-12+at+10.17.50+am.png|30799]