Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: shik on July 30, 2012, 10:50:45 AM
-
Hello again. While I figured out my problem from the other day, it has led to a new one and I am not quite sure how to solve this one....
I am instantiating a duplicate of a sliced sprite and its associated widgets. This will then be used as a content item in a draggable menu (the clipped view panel).
The main issue seems to be that when the duplicate is created, it automatically gets a UIBasePanel script attached to it so when I make the new object a child of the UIGrid, the shader effect for the contents no longer functions correctly. My hierarchy looks something like this.
>Main UIPanel
> GO #1 (no UIPanel attached, it is just a slicedSprite)
> GO #2
> etc.
>Side menu (Empty GO for anchoring)
> Drag Panel (the UIPanel controlling the whole side menu
> Grid (UIGrid)
After a make the duplicates, they are initially placed in the root, I position, scale, and child them immediately but it ends up looking like this:
>Side menu (Empty GO for anchoring)
> Drag Panel (the UIPanel controlling the whole side menu
> Grid (UIGrid)
> GO #1 (UIBasePanel script attached)
> (same with any other objects added)
So I am pretty sure the BasePanel is being automatically attached to make sure the slicedSprite can render, but in this case it is interfering with my draggable panel.
I have tried disabling/removing the script and that just causes the panel to stop rendering (even after it is a child of the side menu Panel).
Has anyone else had any problems like this?
PS - sorry for the long winded post, I figured too much info was better than too little.
-
I have gotten the clones to be drag panel contents without them getting a UIBasePanel added, but now the text I have on those clones no longer appears. I have noticed that as each object begins to clip, the text appears when the label object starts having the shader effect applied.
Any ideas?
-
You need to use NGUITools.AddChild to instantiate it, not Unity's Instantiate. Furthermore, you should save whatever you're instantiating as a prefab first. Lastly, the fact that you are using UIBasePanel tells me that you're using the free version of NGUI, which technically doesn't come with support. ;)