Author Topic: Possible NGUI problem - label update after setting the anchor to be active  (Read 3919 times)

cdevl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
I have a possible NGUI issue. I'm running version 2.5.1 (paid). I have 3 anchors defined under my 2d root. One of them is disabled by default. It gets enabled and filled by information after mouse hovers over one of the meshes in my game. So, I activate the anchor and immediately in the same method set a whole bunch of labels that are sitting (indirectly) under that anchor. I made sure that game knows not to keep updating labels every frame after they were updated once. I've noticed that screen doesn't reflect the information I put in there. I decided to delay filling the labels by one frame after anchor gets activated. And everything started to work. It looks like any changes that are done in the same frame when anchor gets activated are ignored.

I apologize if this was posted previously. I did search the forum and couldn't find anything.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Anchor is a script that simply repositions the object, and has nothing to do with widgets or labels in general... so my guess is the issue is somewhere in your code. Also 2.5.1 is pretty old, you really need to update as only the latest version can be supported.

cdevl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Sorry if I wasn't clear. I just use anchors to enable/disable certain parts of the HUD. The labels I'm setting are sitting at various depth under these anchors.

I will upgrade to the latest and see if problem still exist.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Again though, I am not sure what anchors have to do with enabling or disabling parts of the HUD. Anchors are only used for positioning objects -- gluing an object to a side of the screen for example.

cdevl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Exactly. So my HUD is divided into LeftTop, LeftBottom, RightBottom parts. Some of these parts need to appear/disappear dynamically. Anchors that glue these parts to specific areas of the screen are a logical way of controlling HUD parts visibility.

Anyway. Looks like the problem was resolved in the latest version.