- Home /
Multiple DOTween animations in the same object
Im using DOTween to animate some gameobjects. I have two animations on the same object. The first animation, it plays automatically when is activated. I want to play the second animation in a certain moment. How can I do that?
Here's a screenshot of how I have the animations in the gameobject.
Answer by monsterkillu · May 17, 2017 at 01:38 PM
@DarkSlash : I think you can do that in two ways.
One I prefer would be to add a String ID to both DoTween Animation. Then in the script you can call the function when you click on button or in action,
//Make Sure to include
//using using DG.Tweening;
DOTween.Play ("YOUR_ID_HERE");
(Or you can have a DOTweenAnimation[] dotweenAnims; array to store the animations by GetComponents<>() and call the DoPlay() function of it)
Answer by oStaiko · Oct 26, 2016 at 02:23 AM
Do you know the exact moment in time, or is this an unknown time, such as whenever a player jumps or attacks? If it's exactly known, then try using the delay option on the second script. If the time is unknown, then try having it called at a certain time in a script. If you meant to have the second animation play x seconds after the first, I'd recommend calling both in script, such as:
DoAnimation ()
{
Animate1();
//Wait 2 seconds
Animate2();
}
I play the first animation when the object is activated, as it shows in the graphic, and the second animation I want to play it when I click on a button.
Facing the same problem, I don't think DOTween supports this sort of setup. It's best to do it from code...
Your answer
Follow this Question
Related Questions
DOTween, tk2dTextMesh and float 0 Answers
transform position and dotween 0 Answers
Is there in Unity something like Tween-effects? 1 Answer
DoTween - how to add ease type? 1 Answer
DOTween & how to undo SetBlendableScaleBy tweens that get killed 0 Answers