Author Topic: Object layer changing  (Read 4349 times)

Zoidster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Object layer changing
« 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?

alexh0101

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Object layer changing
« Reply #1 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Object layer changing
« Reply #2 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.

Zoidster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Object layer changing
« Reply #3 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.

Zoidster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Object layer changing
« Reply #4 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?
« Last Edit: December 22, 2014, 03:48:41 AM by Zoidster »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Object layer changing
« Reply #5 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.

Zoidster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Object layer changing
« Reply #6 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
« Last Edit: December 22, 2014, 10:34:52 AM by Zoidster »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Object layer changing
« Reply #7 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:
  1.         static public void SetLayer (GameObject go, int layer)
  2.         {
  3.                 go.layer = layer;
  4.  
  5.                 //Transform t = go.transform;
  6.                
  7.                 //for (int i = 0, imax = t.childCount; i < imax; ++i)
  8.                 //{
  9.                 //      Transform child = t.GetChild(i);
  10.                 //      SetLayer(child.gameObject, layer);
  11.                 //}
  12.         }

Zoidster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Object layer changing
« Reply #8 on: December 22, 2014, 10:47:35 AM »
First thing tomorrow ;)
Time-zones are annoying.

//edit
Looks like it worked. Thanks again.
« Last Edit: December 23, 2014, 05:22:29 AM by Zoidster »