0
\$\begingroup\$

I have a particle system that draws a blood splat. I have a Tilemap that represents terrain. However, the blood splats, which are on a sorting layer in front of the terrain, are somehow rendered both in front of and behind the terrain.

Example

I have encountered similar problems before where the particles had some different Z value than the terrain, but that is not the case this time (3D view):

enter image description here

Here are the Inspector panels for these objects.

First terrain:

enter image description here

The renderer for the upper (in Y) blood particle system:

enter image description here

And for the lower (in Y) system:

enter image description here

And finally my sorting layers, where Base is behind Foreground:

enter image description here

What might cause this behavior and how can I fix it?

Edit: Here is the entire BloodSplat prefab:

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Well I got a few tips for you to try to get it working :

  1. I'm not really sure what the exact issue is. I think it might might actually be a bug in Unity. Anyways, it deals with the SpriteRenderer and the order in which it is applied to the gameobject (relative to the Particle System).Try to remove the SpriteRenderer, and then add it (or just create a whole new gameobject and add the Particle System first). After doing this, You Should be able to change the sorting layer of the particle system. Another workaround would be to create a separate particle system gameobject and attach it (as a child) to the main gameobject.

  2. Alternatively, you can specify when your particle system has to be rendered. You can check the particle systems rendering order in frame debugger and if you want to push it front, you can increase renderqueue value by increasing the Custom Render Queue value.

enter image description here

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Your second suggestion worked, but I had difficulty understanding the first suggestion. Maybe I set up the particle system incorrectly. There's no SpriteRenderer though. I'll have to add a screenshot to the original post. \$\endgroup\$ – slerfsterdn Jul 12 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.