Hey guys i just noticed something i made a script earlier on which enables and disables my scripts when the right key is pressed it enables it or disables it. I will give an example When i press the N key my current player will get deleted from the prefab that it came from and the new object will show up, and at the end it will stop the move script for the first player. Now the problem is when i press the M key it should bring back the main Player that i was using but it brings up nothing it deletes the second player and then does not transform the main player back this is because it has deleted my Player from the prefab i was wondering if i could turn its Check Box of instead of deleting the player here is my script:
//drag your spawn point to here in the inspector - probably make it an empty gameobject so you can move it about on the diving board
var spawnPlayer1 : Transform;
var MainPlayerPlayer2: GameObject;
var NewPlayerPrefab2 : Transform;
function Update()
{
if(Input.GetKey(KeyCode.M)){
Destroy(MainPlayerPlayer2); // this is the main line, this deletes the gameobject can i disable it instead?
Instantiate(NewPlayerPrefab2,spawnPlayer1.position,spawnPlayer1.rotation);
GetComponent(NewMoveScript).enabled = true;
}
}