IEnumerator positionCheck() { while (true) { cachedPos = myTransform.position; yield return(new WaitForSeconds(0.1f)); //Update interval set to 0.1 sec. if (cachedPos != myTransform.position) { root = rootGo.GetComponent <CatmullRomSpline>(); root.AddNode(thisGameObject); } } }
void AddNodeToSpline() { if (root != null) { if (isPush) { root.PushNode(thisGameObject); } else { root.AddNode(thisGameObject); } } //StartCoroutine("positionCheck"); //StartCoroutine("Destroy"); }