Support => NGUI 3 Support => Topic started by: Malzbier on August 06, 2012, 06:13:08 AM
Title: UIAnchor and UIStretch wrong update in editor
Post by: Malzbier on August 06, 2012, 06:13:08 AM
I have some wired behavior with the UIAnchor and UIStretch components inside of the editor.
I have a UIAnchor set to TopLeft at a resolution of 480X320
The Position of the Anchor is X:-240 Y:160.
If i go to the scene view and press save the position is now: X:-213.3333 Y:160.
And if i save again (noting deone between this steps) the position is now: X:-320 Y:160.
Is it possible that this scripts are using the scene view in this case because it does not fit at all with the game view.
A nearly the same problem i have with the scale of UIStretch
The scale of the sprite is X:480 Y:320.
If i go to the scene view and press save the scale is now: X:640 Y:480.
My understanding is that this should be only reacting to the Game view and not the Scene view. The current Behavior makes testing very annoying.
PS: I'm using a UIRoot with the settings Automatic = True and Manual Height = 480
Greetings Malzbier
Title: Re: UIAnchor and UIStretch wrong update in editor
Post by: ArenMook on August 06, 2012, 02:52:44 PM
Make sure that the size of your game window is actually able to fit the dimensions properly. Unity screen dimensions may also be delayed by one frame at edit time. If you try resizing the game window you will notice that the UI will not scale with it as you would expect to see it (and as it does if you're playing). This is because Unity is simply not sending out any update events. Without updates, there is nothing to tell the UI that the screen has changed and that it needs to be updated.
Title: Re: UIAnchor and UIStretch wrong update in editor
Post by: Malzbier on August 07, 2012, 03:06:48 AM
The updating is not the problem , the problem is that the UIAnchor and UIStretch components are using the size of the scene window instead of the game window.
The problem is that i have to build a layout that fits for the resolution of 480X320 and if i change over to my scene view , this components are using the size of the scene view size to reposition and recalculate size.
Im not sure if it is related to this but the variable MScreenSize of UIPanel is changing if i go over to the scene view and save.
and resize the scene view to the same dimensions of the game view is not an option...
Title: Re: UIAnchor and UIStretch wrong update in editor
Post by: ArenMook on August 07, 2012, 12:01:18 PM
That doesn't happen here, so I don't know what to tell you.
Title: Re: UIAnchor and UIStretch wrong update in editor
Post by: Malzbier on August 08, 2012, 03:32:01 AM
You are using Camera.pixelRect to determine the size of the screen and so i wrote a debug script: (attached to the GUI camera)