I have been trying to make a basic game the past few days in unity but I have hit a bit of a problem. The game is functioning and the basics are done but when I compile it the player does not appear but does function in Unity. The prefab itself works when I place it but using the code to place the player in the game does not. This is the code I am using to do it.
function Update () {
if (player == "null" && playerLives >= 1 && start){
playerLives --;
Instantiate(playerShip, Vector3(0,-4.5,2), Quaternion.identity);
player = GameObject.FindGameObjectWithTag("Player");
}
}
Taking out player == null allows the ship to spawn but then it ignores the lives system. What can I do to workaround this?