Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Tile Map Change "Order in Layer" of individual Tiles by Script

Discussion in '2D Experimental Preview' started by Dejan90, Feb 22, 2017.

  1. Dejan90

    Dejan90

    Joined:
    Jul 20, 2015
    Posts:
    2
    Hello,
    I'm currently using a script which is sorting certain gameobjects, within a sorting layer, by their y position. Now I want to do the same with all tiles, within a layer, of my tilemap. But I'm kind off lost by figuring out, how to get acess to the sorting order, of each tile. Can somebody help me, by telling me how to change the sorting order of tiles by scripts?
     
  2. snarlynarwhal

    snarlynarwhal

    Joined:
    Jan 16, 2014
    Posts:
    23
    This would be useful to me as well.
     
  3. kurasu1415

    kurasu1415

    Joined:
    Jan 27, 2015
    Posts:
    6
    Has anyone found a solution to this? I know how to write custom tiles but you don't seem to have access to a spriterenderer, only a sprite. I desperately need a solution here.
     
  4. snarlynarwhal

    snarlynarwhal

    Joined:
    Jan 16, 2014
    Posts:
    23
    I think that the tiles all render as a single mesh making it not possible at the moment.
     
  5. furroy

    furroy

    Joined:
    Feb 24, 2017
    Posts:
    93
    I worked around this by making multiple tilemaps with different sorting layers and put/move the tiles onto the appropriate tilemaps.
     
    ElnuDev likes this.
  6. ElnuDev

    ElnuDev

    Joined:
    Sep 24, 2017
    Posts:
    298
    Incredibly simple, incredibly genius. Thank you.
     
unityunity