Author Topic: Flickering when setting anchors at runtime  (Read 1313 times)

Vesuvian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Flickering when setting anchors at runtime
« on: June 18, 2014, 11:50:51 AM »
Hey guys

This is probably an easy one. At runtime we instantiate UIRect prefabs and set anchors, transform, depth and size. It looks like there is an initial frame where the rect occupies the full screen, producing a "flicker" effect.

I assume that the parent orients the rect correctly on the following Update call. I'm wondering if there's a way to schedule an immediate re-orientation?

Thanks,
Ves

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Flickering when setting anchors at runtime
« Reply #1 on: June 18, 2014, 04:43:06 PM »
UIRect has the UpdateAnchors() function. Call it to immediately update all calculated values.

Vesuvian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Flickering when setting anchors at runtime
« Reply #2 on: June 19, 2014, 03:21:35 AM »
Nice and easy, works perfectly. Thanks Aren!