Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Isamson on May 08, 2014, 04:37:26 PM

Title: Anchoring bug in 3.5.8
Post by: Isamson on May 08, 2014, 04:37:26 PM
I've just upgraded to 3.5.8 and discovered the execute feature with the UIAnchor, and also a bug.

I have map that is anchored to the main panel so that it can scale to the window size. Just under it I have map icons that are anchored to the map itself. If I move the map to the side and then bring it back to the center of the screen, the map icons do not follow.

But if I remove the anchor from the map, the icons positions work fine.
Title: Re: Anchoring bug in 3.5.8
Post by: ArenMook on May 09, 2014, 05:32:23 AM
Using which setting? If you have it on OnEnable, then it only updates the position once and never again. OnUpdate (which is what the previous version was always on) would update it every frame.
Title: Re: Anchoring bug in 3.5.8
Post by: Isamson on May 15, 2014, 07:56:45 AM
Everything is set to update. One thing I discovered is that the icons follow the map, but they are not rendered. What I mean by this is that if I pause unity and look at the scene, I can see the widget bounding box, but the sprite is not shown. As soon as I modify anything about the sprite (position, rotation, scale, depth, etc) it reappears. I figure this is because this forces the sprite to update.
Title: Re: Anchoring bug in 3.5.8
Post by: ArenMook on May 15, 2014, 11:27:09 AM
There can be two reasons for this.

1. You placed your widget on the same game object as your UIPanel. You can't have your widget be on the same object as your panel.
2. You moved the object at some point to a different parent at run-time and did not notify it that you've changed its parent (NGUITools.MarkParentAsChanged)
Title: Re: Anchoring bug in 3.5.8
Post by: Isamson on May 15, 2014, 12:37:35 PM
1. The widget is not on the same GO as the UIPanel
2. I'm not changing parent at runtime.

Could using the advanced anchor type have anything to do with this? Because I just noticed that the map icons (child of the map) are using the advanced anchor type since I'm re-scaling the map dynamically.
Title: Re: Anchoring bug in 3.5.8
Post by: ArenMook on May 16, 2014, 12:44:36 PM
Depends on how you have it all anchored.
Title: Re: Anchoring bug in 3.5.8
Post by: Isamson on May 16, 2014, 01:11:40 PM
Found it. For some stupid reason I had anchored the left side of the map to itself with a 0 offset. This probably resulted in a weird behavior with the whole thing.

Thanks for your help!

**Veto That**

Back to square one

Map: anchor type= Advanced, Execute= OnUpdate, Left: target=MainPanel Left + 0, right: target= MainPanel right + 0
  - Icon: anchor type = Unified, Execute = OnUpdate, All sides set to custom. value range within 0-1 and offset is -15 or 15 (based on sprite size)

If I remove the the map anchor, all sprites are shown. If the map has an anchor, they disappear.