Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: nguiman on February 27, 2014, 10:12:18 PM

Title: UIPanel under a UIWidget not refreshing
Post by: nguiman 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.

Title: Re: UIPanel under a UIWidget not refreshing
Post by: rain on February 28, 2014, 08:31:36 AM
Does the shader on your UITextures support transparent stuff?
Title: Re: UIPanel under a UIWidget not refreshing
Post by: ArenMook 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.
Title: Re: UIPanel under a UIWidget not refreshing
Post by: nguiman 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!
Title: Re: UIPanel under a UIWidget not refreshing
Post by: ArenMook 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.
Title: Re: UIPanel under a UIWidget not refreshing
Post by: nguiman 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.
Title: Re: UIPanel under a UIWidget not refreshing
Post by: nguiman 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.
Title: Re: UIPanel under a UIWidget not refreshing
Post by: ArenMook 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.