hello guys ! first of all i want to thank very warmly every personn that take of his time to contribute to this forum , you guys have helped me very very much !
i have a problem with a game i am programming , i have a zombie ennemy that fallow and attach my player !
i wanted to create more of this zombie (prefab) over time , and i have managed to do so by using :
[
#pragma strict
// this is the object(prefab) i am duplicating
public var zombprefab: Rigidbody;
// this is the position on the scene to wich the zombie spawn
public var spawn: Transform;
function Start ()
{
}
function Update ()
{
// WHEN I PRESS THE R KEY THE ZOMBIE SPAWN
if(Input.GetKeyDown(KeyCode.R))
{
var zombieinstance: Rigidbody;
zombieinstance = Instantiate(zombprefab, spawn.position, spawn.rotation);
}
}
the zombie spawn correctly to the wanted place , but when i kill the first zombie all the other zombie that i made , die at the same time , because they are essentialy clone of the first zombie
but i have noticed that when i duplicate the first zombie on the scene by rigth clicking on the object on the hierarchy and duplicating , the clone of the first zombie dont die when i kill the first one
how can i make it so that when a new zombie spawn he is not affected by the death of the first zombie ? can any one help ?