DOTween - Possible RectTransform enhancement request
« on: February 03, 2016, 09:31:53 PM »
Using Unity's new UI features, it's my understanding that the proper way to move UI panels on and off of the screen in a resolution independent manner is by modifying the associated RectTransform's anchorMin and anchorMax vectors. Currently, I'm accomplishing that via a sequence of generic tweens something like this:

Code: [Select]
    DOTween.Sequence()
        .Join(DOTween.To(() => rect.anchorMin, x => rect.anchorMin = x, new Vector2(1f, 0f), 1f))
        .Join(DOTween.To(() => rect.anchorMax, x => rect.anchorMax = x, new Vector2(1f, 0f), 1f))
        .SetRelative(true)
        .Play();

The above moves the RectTransform 1 full screen to the right without knowing anything about the screen resolution - which is the whole point.

This seems like it might be a reasonable candidate for some "shortcut" methods, such as:

Code: [Select]
DoAnchorMin(...)
DoAnchorMinX(...)
DoAnchorMinY(...)

DoAnchorMax(...)
DoAnchorMaxX(...)
DoAnchorMaxY(...)

Thanks for your consideration and a GREAT product!

Jeff
« Last Edit: February 04, 2016, 03:24:52 PM by jgodfrey »

Re: DOTween - Possible RectTransform enhancement request
« Reply #1 on: February 06, 2016, 04:45:47 PM »
Additionally, since it's likely that both the min and max anchors will be moved together (to simply tween a UI element on/off the screen), maybe some additional, single-tween variations might make sense:

Code: [Select]
DoAnchor(Vector2 targetMin, Vector2 targetMax, ...)
DoAnchor(Vector2 relativeTargetBoth, ...)