Hello Guest

Author Topic: Strange sorting issue with my tilemaps and images in the scene.  (Read 3860 times)

codejoy

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Strange sorting issue with my tilemaps and images in the scene.
« on: October 25, 2015, 10:17:52 am »
So it is like the tile map in my level just stopped caring about sorting layers.  I introduced this bug but I am not sure how, best guess was I was trying to get my game working on my mobile. It was not rendering the tilemap when my tiles had a sprite/diffuse on it (I wanted some simple point lights to brighten up areas of the level).     Somebody on stack over flow helped with an answer:

http://gamedev.stackexchange.com/questions/109976/unity-2d-diffuse-sprites-not-rendering-on-mobile/110120#110120

This answer (as can see above I posted in comments a lot) proved to only semi work on mobile and really messed up things that to me shouldn't of messed up.  Mostly with rendering.  I noticed things were flipped and I had to scoot backgrounds of my tilemap from -0.1 to 0.1 to get them behind the other pieces of the foreground of the level etc.   This is fine and worked, the other problem I noticed though was that now a lot of images i had in my level that were supposed to be drawn in front of the background and behind the platforms and foreground are now just being drawn in front of everything.  It is strange as I have my sorting layers all set:

Background of tilemap sorting layer is set to Background (and the zoffset is 0.1 for the background)

My foreground or where my platforms are has a sorting layer six layers above background.  My sprite images in level that are not tilemap but that I want to show up infront of background but behind platforms is set to some sorting layer after background and before Platforms.  Yet it all renders infront of the tilemap.  (Attached image).  I am going nuts trying to figure this out, it was working fine and I know it is something I did but I have no idea where to begin looking and I need to learn for the future what might of caused this.