public MinimapIcon(GameObject trackedObject, GameObject uiElement, GameObject uiPointer, Minimap.IconStyle style) { this.Rotation = true; this.Style = style; this.obj = trackedObject.transform; this.uiRect = uiElement.GetComponent <RectTransform>(); this.pointerRect = uiPointer.GetComponent <RectTransform>(); CatchDestroy component = this.obj.GetComponent <CatchDestroy>(); if (component == null) { this.obj.gameObject.AddComponent <CatchDestroy>().target = uiElement; } else { if (component.target != null && component.target != uiElement) { UnityEngine.Object.Destroy(component.target); } else { component.target = uiElement; } } }
public MinimapIcon(GameObject trackedObject, GameObject uiElement, Minimap.IconStyle style) { this.rotation = false; this.style = style; this.obj = trackedObject.transform; this.uiRect = uiElement.GetComponent <RectTransform>(); CatchDestroy component = this.obj.GetComponent <CatchDestroy>(); if (component == null) { this.obj.gameObject.AddComponent <CatchDestroy>().target = uiElement; } else if ((component.target != null) && (component.target != uiElement)) { UnityEngine.Object.Destroy(component.target); } else { component.target = uiElement; } }