start path tweening after animation
« on: July 24, 2015, 07:07:50 PM »
Hi, i've this problem.
In my scene there is a sprite (a spider) that fall from top on a web with an animation, next i will start a dopath-tween from a trigger on the last frame of animation that launch a function (walk) from the script attached to the sprite.
here is the script:

public class spiderScript : MonoBehaviour {
   Vector3[] waypoints = new[] { new Vector3(-1.4277f,-0.3371007f,0f), new Vector3(-0.08050418f,0.1498377f,0f) };
   
   void Start() {
      DOTween.Init();
   }

   void walk() {
      Debug.Log ("begin walking");

      transform.DOPath(waypoints, 4, PathType.Linear, PathMode.Full3D, 10, null)
         .SetDelay(0.3f)
            .SetEase(Ease.Linear)
            .SetAutoKill(true)
            .OnComplete(endFunction);
   }
   
   void endFunction() {
      Debug.Log ("finish walk");
   }
}

i can see in console both message, start and end walking, and in runtime i can see the waypoints, but the spider never moves.
If i attach same script on another sprite, and put the doPath commands in the start function, it works flawless.
Where is my error?

thanks

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: start path tweening after animation
« Reply #1 on: August 04, 2015, 05:56:38 PM »
Hi and sorry for the late reply (the notification system broke),


I don't see any evident error in your code. Can you send me a sample unityPackage that replicates this issue, so I can check it out?