/// <summary> /// Called to initialize the object /// </summary> public void Awake() { mDriver = gameObject.GetComponent <MoveToDriver>(); if (mDriver != null && Waypoints.Count > 0) { if (Randomize) { mCurrentIndex = UnityEngine.Random.Range(0, Waypoints.Count - 1); } else { mCurrentIndex = 0; } mDriver.Target = Waypoints[mCurrentIndex]; } }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (MoveToDriver)target; mTargetSO = new SerializedObject(target); }