Not that there is anything wrong With NGUI tweening method, but i wanted something with a few more options and intricacy, so i tried to give HOTweens successor DOTween a go. And it seemed to work, until anchors got involved.
if you tried tweening anything with DOTween that had an anchor...it would move, and then snap back to it's from. So i discovered that NGUI movement tweening does a little thing in the background which updates the anchors rect as you tween which caused me to come up with this.
public static Tweener DOLocalMoveWidget (this Transform target, Vector3 endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
{
return DOTween.To(()=>target.localPosition,x=> target.localPosition = x,endValue,duration).OnComplete(()=>{TweenPosition.Begin(target.gameObject,0,endValue).PlayForward();if(callback!= null)callback();});
}
public static Tweener DOLocalMoveXWidget(this Transform target, float endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
{
return target
.DOLocalMoveX(endValue,duration,snapping
).OnComplete(()=>{TweenPosition
.Begin(target
.gameObject,
0,
new Vector3
(endValue,target
.localPosition.y)).PlayForward();if
(callback
!= null)callback
();}); }
public static Tweener DOLocalMoveYWidget(this Transform target, float endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
{
return target
.DOLocalMoveY(endValue,duration,snapping
).OnComplete(()=>{TweenPosition
.Begin(target
.gameObject,
0,
new Vector3
(target
.localPosition.x,endValue
)).PlayForward();if
(callback
!= null)callback
();}); }
public static Tweener DOLocalMoveZWidget(this Transform target, float endValue, float duration, DG.Tweening.Core.TweenCallback callback = null, bool snapping = false)
{
return target
.DOLocalMoveZ(endValue,duration,snapping
).OnComplete(()=>{TweenPosition
.Begin(target
.gameObject,
0,
new Vector3
(target
.localPosition.x,target
.localPosition.y,endValue
)).PlayForward();if
(callback
!= null)callback
();}); }
And it all seems to work, with now what seems to be one small exception if after deactivating the view these tweens were in and returning to it, the DOTweens now no longer show any visible sign of interpolation..but after their duration is up the oncomplete is called and they snap to their target "to" which indicates that the onComplete is being called and NGUI UITweens are being called...So my question is is there something that UITween does that is causing this? or does anyone have any suggestions about the code above to fix this?
I will keep experimenting and update with progress or discoveries as to the exact cause of the issue if i can.