Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Jordy on December 29, 2016, 05:54:34 PM

Title: Fade in a modal
Post by: Jordy on December 29, 2016, 05:54:34 PM
I just started learning NGUI. Now I have the following Hierarchy:

- UI Root
|-- Camera
|-- Panel
|-- |-- Main
|-- |-- |-- Button Settings
|-- |-- |-- Button Ranking
|-- |-- Settings MODAL
|-- |-- |-- Control - Background
|-- |-- |-- Control - Simple Text
|-- |-- Ranking MODAL
|-- |-- |-- Control - Background
|-- |-- |-- Control - Simple Text

I have three questions about this:

Title: Re: Fade in a modal
Post by: ArenMook on December 31, 2016, 07:41:56 AM
1. It's actually often better to have multiple panels. Moving panels around is much more efficient than moving widgets around. I always recommend the "one panel per window" rule.

2. Put a TweenAlpha on the settings and rankings widget/panel. Use PlayTween on the button in order to move it in -- that's one option. A better option is to download the Starlink UI kit and use the UIWindow code from there. It's designed to fade in windows (panels), keeping history of them in the process in order for you to be able to click a "back" button. Use the UIWindowButton script.

3. That's really up to you.
Title: Re: Fade in a modal
Post by: Jordy on December 31, 2016, 11:26:02 AM
1. It's actually often better to have multiple panels. Moving panels around is much more efficient than moving widgets around. I always recommend the "one panel per window" rule.

Thank you, but isn't each panel an extra draw call? Shouldn't I minimize the amount of panels when developing for mobile phones?
Title: Re: Fade in a modal
Post by: ArenMook on January 04, 2017, 09:43:56 AM
Yes, each panel is a separate draw call. As I said though, one window = one panel rule should keep it fairly low, unless you expect to have many windows open at the same time. Inactive windows don't contribute draw calls.