Hi can some please tell me what this code means please
am thinking its the script for respawning
{
var _DeadUsePhoton : GameObject;
_DeadUsePhoton = GameObject.Find(“_GameManager/UsePhoton”);
_DeadUsePhoton.SendMessage(“Dead”, Respawn[Random.Range(0, 13)]);
}
Am wanting to point the spawn point to a particular game object can someone lead me to the right direction please
thanks in advance
// this defines a GameObject
var _DeadUsePhoton : GameObject;
// this sets the game object to the first instance of an object called “_GameManager/UsePhoton” (mind you that this is a in game object, not a prefab.)
_DeadUsePhoton = GameObject.Find(“_GameManager/UsePhoton”);
// this sends a message to that object “Dead”
_DeadUsePhoton.SendMessage(“Dead”, Respawn[Random.Range(0, 13)]);
To make this work, you will need to first use the Name of the object, not it’s path. Next, you will need to add a script to that object that has a method(function) in it named “Dead”. This method will need to accept whatever type Respawn is.
function Dead(obj:GameObject){
// this creates a new "obj" where the old "obj" was.
var mob:GameObject = Instantiate(obj, obj.position + Vector3.up, obj.rotation);
}
Thank you
I will trial this and get back to you with hopefully a successful outcome