I have some codes below
[SerializeField] int playerLives = 3;
void Awake()
{
int numGameSessions = FindObjectsOfType<GameSession>().Length;
if(numGameSessions > 1)
{
Destroy(gameObject);
}
else
{
DontDestroyOnLoad(gameObject);
}
}
Explain situation:
