1
DOTween & DOTween Pro / 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
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