Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - catbandit

Pages: [1]
DOTween & DOTween Pro / Tween caching issue
« on: July 21, 2015, 02:04:58 PM »

I am using DoTweenPro and I am trying to implement a floating score feature that shows above the enemies whenever you hit them. I have added a tweenComponent to a FloatingScore gameObject that moves the score text relative to the position of the object it is shown above. However if I add the FloatingScore gameObject to an object pool, for some reason the DoTween system caches the start position of the first object to which it is shown above. Whenever I get an already used FloatingScore object from the pool, although I change its transform, the tween is moved relative to the previous position of the object. I have gone through the DoTween documentation and read that the DoTweenPro system is actually caching the tweens for optimization purposes and I am pretty sure that this is causing my issue. Is there a way to disable the cache or to reset the tween values?

I have workaround the issue by removing the DOTweenAnimation component from the game object and simply using DOMove on the transform once I get the game object from the pool, but I am not sure that this is the best way to implement.

obj.GetComponent<RectTransform> ().transform.DOMove (alteredPosition, 0.5f).OnComplete(() => obj.SetActive(false));



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

Pages: [1]