1
DOTween & DOTween Pro / Tween caching issue
« on: July 21, 2015, 02:04:58 PM »
Hello,
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));
Thanks
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));
Thanks