Player lives script
im trying to make a player lives script for the unity space shooter tutorial game but it wont work for some reason.
public class PlayerLives : MonoBehaviour
{
public Transform playerShip;
public int playerLives = 2;
public GameObject player;
void Start()
{
if (player == null && playerLives >= 1)
{
playerLives--;
Instantiate(playerShip, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 180));
player = GameObject.FindGameObjectWithTag("Player");
}
}
}
,im trying to create a player lives script for the tutorial shooter game but I'm having trouble, when I implement this script it doesn't seem to let the game run
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613045456im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Randomly destroy all but one gameobject from an array 1 Answer
Possible Infinite Loop Freezing Game 1 Answer
How Create a menu in script and inspector ?? 2 Answers
Why when i color 4 walls of a grid 10x10 it's coloring 10,9,9,8 and not 10,10,10,10 ? 0 Answers
I have a problem with my Camera detecting and following the player!! pls help... 0 Answers