Author Topic: BUG: "Enabled" state is not properly inherited with alpha in nested UIPanels  (Read 6544 times)

Edy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
NGUI 3.0.8 f7

Alpha is nicely inherited in any nested components. However the "enabled" state due to alpha=0 is not transmitted properly in nested UIPanels.

Easy to repro:
  • Open the NGUI example scene "Example 7 - Scroll View (Panel)"
  • Hierarchy: UI Root (2D) > Window Panel > Scroll View > UIGrid
  • Give all items inside UIGrid an UIPlaySound component (multiselect works). Trigger: OnMouseOver, choose any sound file.
  • Click Play and test that the sound plays when mouse touches the items
  • While in Play mode, select "Window Panel" at Hierarchy. Set Alpha=0 in the UIPanel component. Everything disappears.
  • Click the Game window and move the mouse at the position of the (now invisible) items. The sound still plays.
Note that if you change the alpha to 0 in the "Scroll View" object instead of "Window Panel" then the items don't play the sound anymore. They are correctly disabled due to alpha=0 in their parent panel, but not if the alpha=0 is inherited from an ancestor component.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
I'm actually surprised that items would be disabled on alpha = 0, but I guess I'd solve your problem by adding a script that disables the panel after your alphatween.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Yup, this bug was reported along with a fix via email earlier. If I remember correctly, my suggested fix was to add
  1. mMoved = true;
...to UIWidget.OnInit();

Edy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
I'm actually surprised that items would be disabled on alpha = 0, but I guess I'd solve your problem by adding a script that disables the panel after your alphatween.

The ScrollView contents are actually disabled when you set the ScrollView Panel's alpha to 0. But not when the alpha=0 is inherited from an ancestor Panel or Widget.

Yup, this bug was reported along with a fix via email earlier. If I remember correctly, my suggested fix was to add
  1. mMoved = true;
...to UIWidget.OnInit();

Tried, but the problem persists. I don't think this is related with that bug. Actually, when you set a ScrollView Panel's alpha to zero the contained elements are disabled. But if the alpha=0 state is inherited from an ancestor Panel or Widget, the ScrollView and its contents are invisible but the contained elements (colliders) remain active.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I will look into this when I return home tomorrow.