private void OnDestroy() { if (_instance == this) { _instance = null; } }
private void _spawnDirt(Transform parent) { var prefab = DirtRepocitory.GetStationaryPrefab(); var child = Instantiate(prefab, Vector3.zero, Quaternion.identity, parent); child.transform.position = parent.transform.position; }
private void Awake() { if (instance == null) { _instance = this; } else if (instance != this) { Debug.LogError(string.Format("{0} had duplicate dirt repo", name)); Destroy(this); } }