private void Awake() { if (Instance == null) { playerPrefab = Resources.Load("prefabs/Player") as GameObject; Instance = this; playerGo = GameObject.Instantiate(playerPrefab); player = playerGo.GetComponent <Player>(); DontDestroyOnLoad(player); DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); //Destroy(player); } if (playerGo.GetComponent <Player>().hangar.GetHangar().Count == 0) { setDefaultShips(); } }
private void Start() { DontDestroyOnLoad(gameObject); persistantDataManager = PersistantDataManager.Instance; }