Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: mvesich on November 05, 2013, 02:54:16 PM

Title: UIDraggablePanel moves at run-time if Disabled in Editor.
Post by: mvesich on November 05, 2013, 02:54:16 PM
Background:
I have multiple menus in my app, all of which are disabled until they are needed. When needed, they are enabled and fade in, when complete they fade out and are disabled. I have numerous menus that work perfectly, except one troublesome "sub" menu. I only Enable menus in the editor if I am working on them. When any work is done, I simply Disable the game object to keep them out of the way and the app takes care of the details at run-time.

Problem:
I make a selection from a top level UIDraggablePanel, at which point it fades out and the sub menu fades in- OK.
My sub menu is a UIPanel with a separate game object UIDraggablePanel, whose UIDraggablePanel is varying based on the enabled state in the editor. It should NOT vary, but should simply fade in with the coordinates it had in the editor.

Details:
When I enable the sub menu UIPanel game object in the Editor and I run the app, all menus are initialized the same way; they are enabled, alpha set to 0, then disabled until needed. They all work that way. Oddly though, this game object must be Enabled in the editor, to Fade In to the correct position. When it works the position is Transform x=0, y=131.5; Clipping center x=6.000122 y=-131.5.

If the game object is disabled in the Editor and I run it, the sub menu fades in with the UIPanel correct, but the UIDraggablePanel is at some completely obscure location (Transform x=0, y=169732.8; Clipping center x=3206, y=-169732.8).

I have NO code in any of my scripts that even touches a panel position or center. I've even tried adding a UIAnchor with the same results. I'm out of ideas and this is driving me insane trying to find the issue. What could change the run-time of the panel based on the enabling/disabling of the Game Object?
Title: Re: UIDraggablePanel moves at run-time if Disabled in Editor.
Post by: ArenMook on November 06, 2013, 08:57:09 AM
Off the top of my head -- nothing would change it. However, how are you activating your object? Unity's SetActive activates children before parents, which is bad. NGUITools.SetActive does it in a correct order.
Title: Re: UIDraggablePanel moves at run-time if Disabled in Editor.
Post by: mvesich on November 07, 2013, 12:08:10 AM
Thanks for the feedback ArenMook. I have made the changes to NGUITools for potential stability, but am still encountering the issue. I was actually only disabling the root objects, but am open to anything.

It almost seems as if the panel data is corrupt within Unity somehow, which makes little to no sense. Nothing is static, yet when I change buttons within the grid, once I run the app, changes made to the panel and sub objects are not saved. Also, I keep debug tracing this deeper, but have not identified where the coordinate change is occurring. This is soooooo bizarre. I've never seen anything like it in Unity.

Oh well, back to the debugger.