Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Zoidster on December 19, 2014, 10:45:52 AM
Title:
Object layer changing
Post by:
Zoidster
on
December 19, 2014, 10:45:52 AM
Hi,
the layer of one of my particleeffects is always being changed to NGUI.
Its parented to a Sprite and not part of any list or similar.
UIRoot
-UIPanel
--UISprite
---ParticleEffect
I've seen that the UIPanel might change the layer of its children.
What could cause that?
Title:
Re: Object layer changing
Post by:
alexh0101
on
December 19, 2014, 11:52:08 AM
Hi there,
There are 8 duplicates of your question. I think it has to do with some weird database bug yesterday
Title:
Re: Object layer changing
Post by:
ArenMook
on
December 19, 2014, 06:13:50 PM
UIPanel changes the layers of all its children. It's intentional, line 1235 of UIPanel.cs. You can comment out that line.
Title:
Re: Object layer changing
Post by:
Zoidster
on
December 22, 2014, 02:43:01 AM
Thanks ArenMook.
@alexh0101 Yes I seem to have posted quite a lot of these. I deleted the rest of them.
Title:
Re: Object layer changing
Post by:
Zoidster
on
December 22, 2014, 03:32:20 AM
Ok, I commented the line but the layer keeps resetting.
//edit
Funny thing is, the layer stays at NGUI even when I end the game. Do you have any explanation for that?
Title:
Re: Object layer changing
Post by:
ArenMook
on
December 22, 2014, 10:26:21 AM
Well the only other reason for layers changing may be a widget below the particle effect, but your hierarchy doesn't show one.
Title:
Re: Object layer changing
Post by:
Zoidster
on
December 22, 2014, 10:27:35 AM
That's because there isn't one.
//edit
This is more accurate:
UIRoot
-UIPanel
--UISprite
---ParticleEffect
----ParticleEffect
----ParticleEffect
----ParticleEffect
Title:
Re: Object layer changing
Post by:
ArenMook
on
December 22, 2014, 10:40:03 AM
Ok, open up NGUITools.cs, line 1281 and comment out the part that makes this function recursive:
static
public
void
SetLayer
(
GameObject go,
int
layer
)
{
go
.
layer
=
layer
;
//Transform t = go.transform;
//for (int i = 0, imax = t.childCount; i < imax; ++i)
//{
// Transform child = t.GetChild(i);
// SetLayer(child.gameObject, layer);
//}
}
Title:
Re: Object layer changing
Post by:
Zoidster
on
December 22, 2014, 10:47:35 AM
First thing tomorrow ;)
Time-zones are annoying.
//edit
Looks like it worked. Thanks again.