private static Player playerInstance; void Awake(){ DontDestroyOnLoad (this); if (playerInstance == null) { playerInstance = this; } else { DestroyObject(gameObject); } }