Hello Guest

Author Topic: Sorting Order automatically set on activation?  (Read 4320 times)

David Kalina

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 26
    • View Profile
Sorting Order automatically set on activation?
« on: February 11, 2014, 01:49:07 am »
Upgraded to 4.3 and noticed some sort order issues.

Apparently if an object doesn't have an Order in Layer specified, it will automatically have one assigned.  For example, I have a loading screen background sprite which suddenly sees its Order in Layer go from 0 to 1001 once the parent GameObject is activated in-game, and I have no idea why. 

I tried placing a breakpoint inside the setter for SortingOrder but it doesn't get hit.

Is this some weird Unity thing?  It seems like if I set the order value myself, it won't be overridden at runtime.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sorting Order automatically set on activation?
« Reply #1 on: February 11, 2014, 09:37:07 am »
What components are on the sprite?

David Kalina

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Sorting Order automatically set on activation?
« Reply #2 on: February 11, 2014, 07:58:05 pm »
Transform, Mesh Filter, Mesh Renderer, tk2dSprite, Mesh Collider. 

Of course, now that I've changed the Order in Layer to 1, I can no longer reproduce this on this particular object just by changing it back to 0.

It's still happening to other objects, however, like an animated sprite on the same loading screen, which has Transform, Mesh Renderer, Mesh Filter, tk2dSprite, and tk2dUISpriteAnimator on it.  Its Order in Layer goes from 0 to 1003...  why?  I have no idea.  It doesn't happen consistently to all sprites.

I have no explanation for this...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sorting Order automatically set on activation?
« Reply #3 on: February 11, 2014, 09:10:23 pm »
I have no explanation for this either - looking at the code nothing stands out. Let me know if you figure anything out please!