Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: andrew2110 on February 25, 2017, 08:05:58 AM

Title: Anchoring on Screen Resize
Post by: andrew2110 on February 25, 2017, 08:05:58 AM
For the last couple of projects I've had to support Facebook Gameroom, with this users can resize the game window as they want to which has lead me to develop an OnScreenResize method for updating anchoring (so NGUI updates anchors whenever the screen resizes). OnUpdate I try to use sparingly as this is always the major user of CPU time according to the profiler. Is there any chance of an OnScreenResize anchoring type being officially support by NGUI? The way I've got it working feels a bit hacky
Title: Re: Anchoring on Screen Resize
Post by: ArenMook on February 26, 2017, 11:36:42 AM
It is though? UICamera.onScreenResize is the NGUI's callback, and all anchoring gets updated then the screen size changes. UICamera line 1931 -- "UpdateAnchors" is broadcast to the entire UI.
Title: Re: Anchoring on Screen Resize
Post by: andrew2110 on February 28, 2017, 11:10:17 AM
I see, that's not been my experience so far. If anchoring is set to OnUpdate, it updates every frame, if it's set to OnEnable or OnStart it does it once at the beginning and then never again. I shall work out whats going on.