Author Topic: Anchoring on Screen Resize  (Read 4939 times)

andrew2110

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Anchoring on Screen Resize
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring on Screen Resize
« Reply #1 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.

andrew2110

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: Anchoring on Screen Resize
« Reply #2 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.