Hi again,
This one has been stumping me for a long time, also back when I was using a previous UI/tweening tool. I'm not entirely sure if it's something I'm not doing right, or if it's a limitation, but anyway I'll try to explain and hopefully you may be able to help me.
I am writing a phone game for iOS where the user can change the phone orientation from portrait to landscape and the autorotate kicks in. There are three "HUD" panels at the top edge of the screen (top left, top right, and top center) which tween by sliding out when the pause menu panel opens, and sliding back in with a bounce when the menu closes. This *mostly* works fine using the anchors to keep it all consistent, but there is an issue.
Let's say I start in portrait mode. I am using a relative Move tween to for example move my top left panel from its usual offscreen Pos X of -50 to a relative Move X of 50. The panels slide in and out fine when triggered and all looks good. Also, if I start in Landscape mode, it works as well. So I am speculating that perhaps DOTween (or Unity?) could be recording the "at start" resolution somehow and basing calculations off that.
Anyway once the panels are currently onscreen in Portrait and I tilt the phone to landscape, Unity adjusts it fine via the anchors and the panels stay in their correct positions at the top corners and top center, adjusted proportionally for the change in resolution. But then - disaster! When I trigger my tween to slide the panels back out, the panels do not leave properly but instead jump off towards the middle of the screen as if the anchor was somehow still set to the Portrait X sizing. Also when triggering the panels to slide back in, they also clump up on the left and the top right panel ends up in the middle - again I am speculating that somehow the calcs are still thinking the anchor edge is the one from Portrait mode, and that something wasn't refreshed when the phone orientation changed.
Any ideas? This can also be reproduced in the editor by changing the resolution from say iPhone tall to iPhone wide during play. I'm really hoping it's just something I haven't done properly or that there's a workaround for it, so any advice you might have will be appreciated.