Author Topic: UIPanel under a UIWidget not refreshing  (Read 2699 times)

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
UIPanel under a UIWidget not refreshing
« on: February 27, 2014, 10:12:18 PM »

I have a UIPanel, with a UIGrid and a number of empty gameobjects with UITexture children under it. The UIPanel itself is in the hierarchy of a UIWidget.
When I try to disable or TweenAlpha the root UIWidget everything under the UIPanel isn't affected. Adjusting the alpha on the UIPanel doesn't do anything and if I disable/enable the UIPanel the children UITextures remain invisible.

I tried iterating over the UITextures marking them changed and calling Refresh() on the UIPanel but saw no change.

What is wrong? and how can I make this work? I'm using the alpha clipping of the UIPanel.


rain

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 79
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #1 on: February 28, 2014, 08:31:36 AM »
Does the shader on your UITextures support transparent stuff?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #2 on: February 28, 2014, 06:29:11 PM »
All alpha is cumulative in the current version of NGUI, so if you have a panel that's a child of the widget, adjusting the widget's alpha will affect the child. Unless you moved the widget recently via code and didn't call MarkParentAsChanged() on the widgets.

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #3 on: February 28, 2014, 07:28:02 PM »

I tried MarkParentAsChanged() after NGUITools.AddChild (parent, prefab) but when the root UIWidget is disabled/enabled the UITextures under the UIPanel don't consistently reappear. Adjusting the alpha value on the UIPanel has no affect (though clipping works) and adjusting the alpha on the root UIWidget affects everything except the UIPanel and its children.

What are all the dependencies or the proper workflow for placing UIPanels under UIWidgets?

Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #4 on: February 28, 2014, 07:30:52 PM »
What version of NGUI are you using? There was some related issue a few versions back. You don't need to call MarkParentAsChanged unless you actually re-parent the objects. AddChild doesn't count as reparenting because you're creating it from scratch.

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #5 on: March 01, 2014, 12:04:13 AM »

Initially I was instantiating the children myself and then tried marking their parents changed. When that didn't work, I tried AddChild.

My NGUI is an older version, I will upgrade and try. Thank you.

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #6 on: March 03, 2014, 01:53:55 PM »
via the Asset Store I imported over my previous version, but that didn't appear to resolve the issue. In fact it made it worse as  the children UITextures aren't visible at all now. Will have to verify why that is so.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel under a UIWidget not refreshing
« Reply #7 on: March 03, 2014, 10:56:03 PM »
Make sure to follow the upgrade instructions from the readme file or things may not update properly.