Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: mvesich on July 17, 2013, 04:01:23 PM

Title: Dynamically added buttons and AlphaFade not jiving?
Post by: mvesich on July 17, 2013, 04:01:23 PM
[Edited] Sorry so long on 1st pass, tried to shorten it.

My app has multiple menus; 1st determines the contents of the 2nd.


I've attached screen shots of the post-Fade In with no buttons, and the button shown after clicking the Scroll Bar.

Can anyone point me in the right direction?

Question: If I''m using the NGUI TweenAlpha script, and "Play" it forward. Shouldn't it fade all the child panels under it?


Project Hierarchy (misbehaving menu)
* uipanelTrainingSet  Transform_Position_Z = 0
  - Background  Transform_Position_Z = 0  <UISprite>
  - uidragTrainingSet  Transform_Position_Z = -1  <UIPanel>, <UIDraggable Panel>, <TweenAlpha>
    - uigridTrainingSet  Transform_Position_Z = 0  <UIGrid>
      - Button(s)  Transform_Position_Z = 0  <Box Collider>, <UIDrag Panel Contents>, <UIButton Sound>, <Proprietary script>
        - uispriteButton  Transform_Position_Z = 0  <UISprite>
        - Name  Transform_Position_Z = -1  <UILabel>
  - uiscrollTrainingSet <UIPanel>, <TweenAlpha>
        - uispriteButton  Transform_Position_Z = -1  <UISprite>
    - Background  Transform_Position_Z = 0  <UITiled Sprite>
    - Foreground  Transform_Position_Z = 0  <UITiled Sprite>
Title: Re: Dynamically added buttons and AlphaFade not jiving?
Post by: ArenMook on July 18, 2013, 04:34:21 AM
That's due to your positioning of buttons vs positioning of the clipped area. Show the menu in the editor (if you dynamically add buttons, just drag & drop instantiate the prefab a couple of times as if you were doing it at run-time, test, then delete them later). You should see the same result as at run-time. Adjust the clip rect -- there is also a "reposition now" checkbox that might help you.
Title: Re: Dynamically added buttons and AlphaFade not jiving?
Post by: mvesich on July 18, 2013, 11:22:10 AM
Ah! So it was that I'm an inexperienced noob.  I was worried about the Z and depth all this time and overlooked the simplest possibility.  ::)

Perfect!

Thank you ArenMook! Great product, great advice!!