void Start() { target.pivot = new Vector2(0, 1); eventTrigger = GetComponent <EventTrigger>(); EventUtility.CreateEventTriggerEntry(eventTrigger, EventTriggerType.Drag, OnDrag); EventUtility.CreateEventTriggerEntry(eventTrigger, EventTriggerType.EndDrag, OnEndDrag); RestrictToScreen(); }
void Awake() { eventTrigger = GetComponent <EventTrigger>(); EventUtility.CreateEventTriggerEntry(eventTrigger, EventTriggerType.Drag, OnDrag); EventUtility.CreateEventTriggerEntry(eventTrigger, EventTriggerType.EndDrag, OnEndDrag); IEnumerable <IResizeListener> listeners = FindObjectsOfType <MonoBehaviour>().OfType <IResizeListener>(); foreach (IResizeListener listener in listeners) { resizeListeners.Add(listener); } }