Author Topic: Image Button Widget as a Child of Simple Texture Widget  (Read 3541 times)

Dennis59

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Image Button Widget as a Child of Simple Texture Widget
« on: February 24, 2013, 10:38:23 AM »
At the start of the game I'm currently creating there will be two 2D UI's which are Simple Texture widgets.  The first is a splash screen that fades in and out followed by the second which fades in and then stays.  The second will be the main menu background.  On this second screen I want to have a button.  The intent is to have this button fade in with the main menu background.  Since I don't have the full version of NGUI at the moment the code is setup to fade the object and all of its children.  An Image Button widget was created attached to the Panel since I couldn't get it to create as a child of the main menu.  The button, and its child "Background" was dragged to the main menu.  Running the game gives the desired result with the button fading in with the main menu.  However, the second time the game is run the Image Button's child (Background) moves to become a child of Panel again.  The button object remains a child of the main menu.  Now the button appears immediately and does not fade with the panels as desired.  I've tried this a couple of times with the same result.  I could simply make the button a child of the panel and add another script to fade it in and out but this seems unnecessary. 

Here is the Hierarchy with the desired structure (HostServer is the button):


Here is the Hierarchy after running once:



Any thoughts on what is going on here would be appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Image Button Widget as a Child of Simple Texture Widget
« Reply #1 on: February 24, 2013, 11:03:42 AM »
You can't nest widgets. Instead of doing something like this:

Widget A
- Widget B

do this:

GameObject
- Widget A
- Widget B

Also keep in mind the free version of NGUI doesn't come with support. It comes as-is.  :-X

Dennis59

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Image Button Widget as a Child of Simple Texture Widget
« Reply #2 on: February 24, 2013, 11:19:31 AM »
Oops, sorry about that.  Overall I'm very satisfied with NGUI and very definitely appreciate both the ability to preview it and your willingness to provide some help toward that end.

You should be seeing a new order in just a few minutes.   :)