Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: catbandit on July 15, 2015, 02:05:59 PM
-
Hi,
Already posted on the unity forums, but anyways.. I am using the DoTween Pro version. I want to have a panel that slides out from the left side of the window and after a couple of seconds slides back in using a different move algorithm. I have added two DoTweenAnimation scripts to the game object, set them up and named them with different ids - NotificationOut and NotificationIn. In my show function I first rewind and than play both tweens.
panel.gameObject.GetComponent<DOTweenAnimation> ().DORewind ();
panel.gameObject.GetComponent<DOTweenAnimation> ().DOPlayById ("NotificationOut");
yield return new WaitForSeconds(2.5f);
panel.gameObject.GetComponent<DOTweenAnimation> ().DOPlayById ("NotificationIn");
My questions are:
1. Is this the correct way to use the component when having multiple tweens attached to the same game object.
2. How can I subscribe for the onCompleted event of the second tween - NotificationIn.
Thanks in advance
-
Try this:
- For NotificationOut component in the editor enable OnComplete and make a function with the same gameobject
- Under DOTweenAnimation function set, do a DoRestartByID, and set "NotificationIn" string as the value. This is basically saying when the tween completes, callback will trigger the second tween
- In your NotificationIn tween, set delay to 2.5 to give it the pause you want before tweening starts
-
Thank you, cynicalwanderer, that solved my issue.