Author Topic: UIWindow and Panel Tool problems  (Read 3116 times)

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
UIWindow and Panel Tool problems
« on: January 02, 2014, 04:58:39 AM »
I'm having a very frustrating and show-stopping problem when trying to use the Panel Tool.  Maybe I'm not using it correctly.  But right now I can't figure out how to get my menus to display consistently.  I'm using UISK and NGUI 3.0.8f3 (and Unity 4.3.1f1 under Windows 7 SP1).  As far as I can tell, everything is up to date.

I made a copy of the UISK Menu Scene and called it "options test scene".  I played around a bit with the Panel Tool, enabling and disabling some panels so I could see what they looked like, but then set things back to where they began, with only the UIRoot, Main Menu and FPS panels checked.  Hit play in the editor and my main menu shows properly, but when I click the Options button, the main menu panel disappears (appropriately), but the Options panel does NOT appear!  Looking in the Hierarchy I see that the Options panel game object has been activated (it was activated when I clicked the Options button on the main menu panel), but none of its children are active, so no widgets are actually showing.  Why aren't the children being activated recursively?  The only thing I can guess is that somehow the Panel Tool has gotten locked into a bad mode and toggled something to the opposite of what UIWindow is expecting, so they're fighting against each other.  Or maybe it's something completely different.  I'm just guessing.

This is very confusing!  Shouldn't this just work??  The UIWindow functionality (and example scenes) are the whole reason why I bought the UISK.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: UIWindow and Panel Tool problems
« Reply #1 on: January 02, 2014, 07:57:52 AM »
Okay, I have done some more investigations.  This problem seems to happen because of the panel editing process I'm using.  I may be doing something wrong, but here is my process:

  • use the checkbox on the left column of the Panel Tool to select and DE-activate the Main Menu panel, which disables the panel and ALL of its children
  • use the checkbox on the left column of the Panel Tool to select and activate the Options panel, which enables the panel and ALL of its children
  • edit the Options panel
  • use the checkbox on the left column of the Panel Tool to select and DE-activate the Options panel, which disables the panel and ALL of its children
  • use the checkbox on the left column of the Panel Tool to select and activate the Main Menu panel, which enables the panel and ALL of its children

After doing the above, I hit play in the editor I am looking at the Main Menu.  I click the Options button, and the Main Menu fades, but the Options panel doesn't show and replace it.  All the children of "Window - Options" are disabled.

I have found a workaround that seems to help.  In step 4 above, if I disable the Options panel's game object in the Inspector (rather than using the Panel Tool to disable it and all its children), this apparently leaves the children of the Options panel "active" somehow, but disabled by proxy (since their parent, the Options panel game object, is disabled).  Then, when I hit play in the Unity editor, the menu behaves as it should, and when I click the Options button, the menu fades out and the Options panel fades in appropriately.

Is this possibly a bug in the Panel Tool?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWindow and Panel Tool problems
« Reply #2 on: January 02, 2014, 11:27:08 AM »
Panel tool is meant for visualization purposes -- to help you see what's there. The checkbox enables / disables the game object, which is the equivalent of you selecting the game object and hitting ALT+SHIFT+A.

The "back" buttons in SGSK do not open anything. They call UIWindow's "go back" functionality, which only works if there is history present. The Starlink UI kit was meant to start with the main menu -- it's the "root" menu. When you click on a button, such as Options, it adds the current window (read: main menu) to the history list, and open the options window. When you click the "back" button, it hides the current window and opens the topmost window in the history list.

If there is no history, nothing will be opened.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: UIWindow and Panel Tool problems
« Reply #3 on: January 02, 2014, 11:59:32 AM »
I think you've misunderstood what I did, although I did try to be precise. ;)  I didn't do any "back" button clicking.  Just clicked the Options button in the menu panel, but no Options pane came up.  Wasn't trying to "return" to any prior panel.

As for when you say that the Panel Tool is the equivalent of selecting the game object and hitting ALT+SHIFT+A, I've just tested it and that's not actually what the Panel Tool does...  If it did I wouldn't have a problem!

If I use the ALT+SHIFT+A hotkey that you suggested, ONLY the parent object is disabled explicitly, while the children are disabled by proxy (they are grayed out because the parent is disabled, but in the Inspector they are still "checked" as enabled).  I believe this is the CORRECT way to disable a panel.  If I instead use the Panel Tool, it EXPLICITLY disables the panel AS WELL AS ALL its children.  This is the problem.  When UIWindow tries to Show() the window, it only sets the parent panel as Active.  Since all the children were explicitly disabled, they don't show, even though the parent panel was toggled to active.

So it seems that the Panel Tool should do what you thought it did (but actually doesn't).  That would solve the problem.  As for the current status, the Panel Tool is not usable.  Toggling a panel using the Panel Tool incorrectly toggles all panel children.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWindow and Panel Tool problems
« Reply #4 on: January 03, 2014, 05:28:50 AM »
Aha, I see. So it's using some legacy code instead of NGUITools.SetActive. I'll fix it, thanks.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: UIWindow and Panel Tool problems
« Reply #5 on: January 03, 2014, 05:43:35 AM »
Thanks so much! :)  In the meantime, my workaround of manually disabling the panel's game object in the Inspector works fine, so it's not a huge problem.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: UIWindow and Panel Tool problems
« Reply #6 on: January 06, 2014, 08:53:14 AM »
I didn't see it in the patch notes, but it appears to be fixed in 3.0.8 f5.  Thanks!