Author Topic: How to update/ignore anchor when target is hidden?  (Read 1801 times)

UndercoverDesigns

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 7
    • View Profile
How to update/ignore anchor when target is hidden?
« on: August 07, 2014, 10:22:25 AM »
I have a UIPanel and a UIButton on my UI.  The UIPanel has it's Bottom Anchor set to the UIButton.  I have the following code:

  1. NGUITools.SetActive (NextLevelButton, _LevelComplete);
  2. _Player.ToolsPanel.GetComponent<UIPanel> ().ResetAnchors ();
  3. _Player.ToolsPanel.GetComponent<UIPanel> ().UpdateAnchors ();

When this executes, the UIButton shows and hides as expected, but the UIPanel doesn't reposition the bottom to fill the space.

Is there a way to force this to occur?  Am I going about this the wrong way?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to update/ignore anchor when target is hidden?
« Reply #1 on: August 08, 2014, 07:48:31 AM »
What's a button? Is it just a game object, or does it have a widget on it? The code doesn't actually check for something being disabled. If it's anchored, it will use it. The disabled object may not update its anchors in turn, but its dimensions and position will still be used.