private void Start() { // Look to see if TimelineEventManager is in this game object timelineEventManager = gameObject.GetComponent <TimelineEventManager>(); // Throw error if TimelineEventManager can't be found if (timelineEventManager == null) { throw new Exception("Could not find TimelineEventManager inside this game object."); } }
// Get the timeline event manager here and check that eventPage contains the page script private void Start() { // Try to get the timeline Event Manager event here try { // The parent object of object attached to script GameObject parent = gameObject.transform.parent.gameObject; timelineEventManager = parent.GetComponent <TimelineEventManager>(); } catch { throw new Exception("Could not find TimelineEventManager. Make sure that Timeline Event has a parent with a TimelineEventManager Script"); } // Get centered position positionWhereCentered = (transform.localPosition.x) * -1; }