Author Topic: Single frame delay on drawing  (Read 6156 times)

mathiassoeholm

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 35
    • View Profile
Single frame delay on drawing
« on: March 04, 2014, 11:02:05 AM »
Hello!

So I have a panel which gets set active, using NGUITools.SetActive.
Afterwards I do some activating, deactivating and moving some child widgets.
The widget gizmos get updated right away, and are located in the right position, but it doesn't draw the moved widgets until one frame later.

I tried calling refresh on the panel, broadcasting CreatePanel, broadcasting UpdateWidgets, Broadcasting FillAllDrawCalls..
But nothing seems to work.

What to do? :-)

Cripple

  • TNP Alpha
  • Full Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Single frame delay on drawing
« Reply #1 on: March 04, 2014, 11:33:58 AM »
Close your eyes for a second  8)
Graphicstream Dev.

mathiassoeholm

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 35
    • View Profile
Re: Single frame delay on drawing
« Reply #2 on: March 05, 2014, 03:12:38 AM »
I tried closing my eyes, but then everything just disappears!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Single frame delay on drawing
« Reply #3 on: March 05, 2014, 07:13:44 AM »
You move stuff around? If you change parents, be sure to call MarkParentAsChanged.

Make sure you only have one widget per game object.

When you enable a widget it registers itself with the parent panel, and the parent panel will draw it in LateUpdate. If you are moving things before LateUpdate occurs, then all the changes you've done will be reflected in the same frame.

You can force refresh of a panel early using UIPanel's Refresh() function.

mathiassoeholm

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 35
    • View Profile
Re: Single frame delay on drawing
« Reply #4 on: March 05, 2014, 09:01:39 AM »
Fantastic, MarkParentAsChanged fixed the problem! :D