protected void Awake() { positionToShow = new List <Position>(); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } // Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); foreach (Position pos in instances) { if (pos != null) { positionToShow.Add(pos); } } positionToShow.Sort(ComparePositions); }
protected override void Awake() { position = GetComponent <Position>(); if (position == null) { position = gameObject.AddComponent <Position>(); } base.Awake(); PositionRegistry.RegisterInstance(position); }
protected void Awake() { PositionRegistry.RegisterInstance(this); }