Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Unity 2D Isometric Sorting With Particle Systems

Discussion in '2D' started by StiryMixy, May 9, 2021.

  1. StiryMixy

    StiryMixy

    Joined:
    May 5, 2021
    Posts:
    7
    Hello, I need help or advice on how to proceed with utilizing particle systems in a 2D isometric game:

    I've recorded a short video on the kind of problem I'm facing: https://drive.google.com/file/d/1RZl4G62ZZjW6WqWqpYaxiMq8fYJVOUiF/view?usp=sharing

    My particle system is having trouble sorting out properly in an isometric environment, all of the particles (when spawning at the bottom) appear behind the player's sprite, but as the particles rise up, they kind of just fizz in front and behind the player's sprite back and forth.

    I was trying to configure it in a way so that some particles would remain behind the player's sprite, some would spawn in front the player's sprite, and maybe even make it so that the particles spawn around the edges of an isometric tile.

    I think it's a problem with the particles not sorting by y, if anyone can tell me where I could find an option to sort by y each particle for the particle system?
     
    Last edited: May 9, 2021
  2. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    289
    Try project settings > Graphics Custom Sort Axis and set it to y -1 or 1 (the wrong option will probably reverse your entire sorting). The particle effect and your character sprite probably use their bounding box center as a sorting point (that is why they change right in the middle)
    If you can fixing this with clear manually set sorting Ids is probably the most reliable way. Probably duplicate the effect have one entire system always behind and one system always in front. Using just the sorting axis in isometric is really tricky.
     
  3. StiryMixy

    StiryMixy

    Joined:
    May 5, 2021
    Posts:
    7
    My graphics was already set to custom sort axis with -1 as y at the time of the issue.

    I was in a hurry so I went this route you mentioned of creating 2 particle systems, one in the back of the sprite, one in front, with all the modifications and tweaks that comes with such a solution.

    Although I personally am not a fan of creating 2 game objects just to achieve 1 effect but you deal with the hand you get.