private void OnDestroy() { if (Instance != this) { return; } Instance = null; }
private void Awake() { // Singleton local if (Instance != null) { Destroy(gameObject); } else { Instance = this; } _playerPrefabsPool = Resources.LoadAll <GameObject>("").Where(prefab => prefab.GetComponent <PlayerModule>() != null).ToList(); _startingWeaponsPool = Resources.LoadAll <GameObject>("").Where(prefab => prefab.GetComponent <IWeapon>() != null).ToList(); }