playMaker

Author Topic: Particle effect draw order issue  (Read 2477 times)

wirejaw

  • Playmaker Newbie
  • *
  • Posts: 49
Particle effect draw order issue
« on: January 25, 2021, 07:01:01 PM »
This is not Playmaker specific (unless there is a Playmaker solution), but I'm getting crickets about this on the Unity forum.  I'm trying to figure out how to make particle effects play on top of everything else. I have a 2.5D side scroller in progress and my effects currently get obstructed by anything in front of them. I've tried to set "Sorting Layer ID" on the effects to a new layer but still no luck. Any tips?

Winkite

  • Playmaker Newbie
  • *
  • Posts: 1
    • free slots quick hit platinum
Re: Particle effect draw order issue
« Reply #1 on: February 05, 2021, 09:44:52 AM »
Particle System
The Particle System component simulates fluid media like liquids, clouds and anything related to fire by generating and animating a number of small 2D images in the scene. For a more detailed introduction to particle systems and how they can be used, see the documentation page.

Properties
The Particle System component has many properties, and for convenience, the inspector arranges them into collapsible sections or "modules" described below. Each section can be expanded and collapsed by clicking on its header. On the left-hand side are checkboxes which can be ticked to enable or disable certain settings. For example, if you don't want to change particle size during emission, you can simply uncheck Size over lifetime.


In addition to the modules, there are several other controls in the Inspector. The Open Editor button displays the options in a separate editor window, which also allows you to edit several systems at once. And the Resimulate checkbox is responsible for whether the property changes will or won't be immediately applied to the particles just created by the system (alternatively, the existing particles will disappear, since they will be the only new particles whose properties have been changed). The Wireframe button displays outlines of mash objects to show the particles behind them.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Particle effect draw order issue
« Reply #2 on: February 06, 2021, 07:45:50 AM »
hi.
The probably probably is that you use 2.5D
which means you are using 3d object.

in this case you need to make sure the effect is spawned closer to the camera than the 3d objects

layers will not effect 3d

wirejaw

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Particle effect draw order issue
« Reply #3 on: February 17, 2021, 07:25:36 PM »
Thank you for the clarification djdino.

wirejaw

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Particle effect draw order issue
« Reply #4 on: February 17, 2021, 09:03:12 PM »
Up to this point I've been using particle effects as children on my player object, and triggering the effects to fire during various states so that they are positioned where the player is.  However, if I pull the effects objects toward the camera so that they are displayed over everything else they rotate with the player when changing direction right/left (so for example the effect will look fine when facing right, but be behind everything when facing left due to the offset).  I'm guessing I need to use a different system now.  Any tips for alleviating this?  Like should effects generally be built as prefabs and then called to play where you want them to be using collision events or something similar?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Particle effect draw order issue
« Reply #5 on: February 18, 2021, 06:41:15 AM »
Hi.
in our game i use sprites but it could probably work with 2.5D as well.
the player parent has the rigidbody2d which handles movement and collission.
then in a child we have our sprite renderer.
when changing direction we only rotate the child.
The particles that we want to turn with the player, we have set as a child within the child renderer.
The particles that we Don't want to turn with the player, we have set as a child in a separate child (empty object) next to the sprite renderer.

if you are already deep into a project you might want to use set/get position on the particle and not parent to the object.

wirejaw

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Particle effect draw order issue
« Reply #6 on: February 18, 2021, 12:42:51 PM »
I went ahead and changed things around using set/get position instead of parenting and offsetting particles closer to the camera to avoid overlap and things are working well so far.  Thanks again djdino.