Hello Guest

Author Topic: Mix Tileset sprites and particles  (Read 4467 times)

salva

  • Newbie
  • *
  • Posts: 4
    • View Profile
Mix Tileset sprites and particles
« on: January 23, 2014, 12:36:59 pm »
Hello!

This is my issue. I have a scene with a tilemap as background, and some sprites. When i put a unity particle system on scene, it's always rendered between tilemap and sprite, it's impossible change it to render on top of both.
Of course, in 3d views particles are near than sprites, isn't a position problem.

How i can solve this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Mix Tileset sprites and particles
« Reply #1 on: January 24, 2014, 11:29:55 am »
2 things you should check
1. The particle system bounding box z value (does it draw in front if you push it way way in front?) The sorting z is generally NOT the z of the particle system but rather the centre of the bounding box.
2. Do you use the order in layer / render layer on the sprite? That will override everything. If yes, you'll need to set the simlar value to the particleRenderer as well.
3. If the above isn't the case its probably material sort order thats forcing one thing to draw on top of another.
3. If you can't change that, set up #2 on all of the elements to explicitly control everything.

salva

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Mix Tileset sprites and particles
« Reply #2 on: January 31, 2014, 12:57:13 pm »
Solved! Thanks!

Changing sorting order in script do the job.

particleSystem.renderer.sortingOrder = myPositionInLayer;

and all runs correctly.

I made a simple extension for the editor and now i can use inspector for this.