0
\$\begingroup\$

This happens to all particle systems. I tried:

  1. Changing the rendering mode to camera, setting culling mask to UI, particle system layer set to UI

  2. Adding a canvas child, and attaching a particle system to this child

  3. Tinkered with the camera's FoV and projection.

What happened was that the particle system worked in some areas of the UI, and was quite unstable, i.e. could disappear and appear again. I resolved it by adding a sorting group and setting order in layer to 1.

So my question is, why did it work so unstable? In all tutorials I saw it either worked 100% or not at all. What could cause its instability? In the first image, the ps is visible, in the other two not, after I moved it (left and right). So what causes this issue?

enter image description here enter image description here enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ I had once a slightly similar problem, a helpful comment was: Sprites are sorted by their center point, so if the center point of a sprite in the corner happens to be closer to the camera than the center point of the card backing, it will sort in front. You might want to use a Canvas for this - then you can control the layering through canvas hierarchy order, without stacking up z offsets. It might be similar to your problem \$\endgroup\$
    – Zibelas
    Jun 14, 2023 at 10:49
  • \$\begingroup\$ @Zibelas that looks to me like an answer. \$\endgroup\$
    – DMGregory
    Jun 14, 2023 at 12:04
  • \$\begingroup\$ @DMGregory But that was your comment I stole from the question I had myself a year ago \$\endgroup\$
    – Zibelas
    Jun 14, 2023 at 12:07
  • \$\begingroup\$ Is that a problem? If you think the post is too similar, you can vote to treat it as a potential duplicate. \$\endgroup\$
    – DMGregory
    Jun 14, 2023 at 12:10

1 Answer 1

1
\$\begingroup\$

I encountered a similar error once similar to this with a custom card that had different layers of sprites stacked (as in child sprites) to build the card. And sometimes some layers would just vanish. One comment brought me closer to explain the issue:

Sprites are sorted by their center point, so if the center point of a sprite in the corner happens to be closer to the camera than the center point of the card backing, it will sort in front. You might want to use a Canvas for this - then you can control the layering through canvas hierarchy order, without stacking up z offsets. (@DMGregory)

Since the particle system uses sprites as well, you might solve the problem by simply manipulating the sorting order. Adding a sorting group on my GameObject did the trick for me in the end.

\$\endgroup\$
2
  • \$\begingroup\$ Have you tested that the sorting group approach works for particle systems and UI images? \$\endgroup\$
    – DMGregory
    Jun 14, 2023 at 13:22
  • \$\begingroup\$ It works for UI Images. As for the particle system, I could not yet test it. \$\endgroup\$
    – Zibelas
    Jun 14, 2023 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .