If u have only one player u can try to find with tag in Update or make some conditions for finding it. For ex in pathfinding script. Also u need to send "dead" bool to this script before destroing player, and then bump find new object.
private var playerObj : GameObject;
private var bump : boolean;
function Start (){
playerObj = GameObject.FindGameObjectWithTag("Player");
}
function Update(){
var playerScr : NameOfPlayerScript = playerObj.GetComponent(NameOfPlayerScript);
if (playerScr.dead){
bump = true;
}
else {
bump = false;
}
if (bump){
playerObj = GameObject.FindGameObjectWithTag("Player");
}
}
More simple (but expensive) way in Update () drop this:
playerObj = GameObject.FindGameObjectWithTag("Player");
And dont forget to set tag for player :)
Trending Articles
More Pages to Explore .....