Author Topic: UIWidget anchoring right after scene load  (Read 2201 times)

Esa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
UIWidget anchoring right after scene load
« on: December 12, 2014, 03:58:59 AM »
I'm using NGUI 3.7.1 and I use the UIWidget SetAnchor to make the sprite follow a 3D object in the scene. The problem is that right after scene loading it takes X amount of frames before the SetAnchor starts working. On PC that was 2 frames and on 5S it was 10ish frames. Due to this I'd need a solid way of making sure that the UIWidget is anchoring the 3D object.

Is there a property or any other way to know if a UIWidget is following an anchor?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWidget anchoring right after scene load
« Reply #1 on: December 12, 2014, 11:46:18 PM »
UIRect.SetAnchor call set the anchor immediately, and even calls ResetAnchors() and UpdateAnchors() inside, which calls OnAnchor() and repositions your widget accordingly. So you don't even have to wait any frames.

This only happens if the update condition is set to something other than OnStart, however. OnStart only updates once.