void Awake() { if (!vessel) { vessel = GetComponent <Vessel>(); } if (!vessel) { Destroy(this); return; } //destroy this if a target info is already in the system IEnumerator otherInfo = vessel.gameObject.GetComponents <OrXTargetInfo>().GetEnumerator(); while (otherInfo.MoveNext()) { if ((object)otherInfo.Current != this) { Destroy(this); return; } } OrXTargetManager.AddTarget(this); vessel.OnJustAboutToBeDestroyed += AboutToBeDestroyed; }
void Awake() { if (instance) { Destroy(instance); } instance = this; holoCache = null; resetHoloCache = false; }