Game Development Reference
In-Depth Information
When the particles render, by default, they are always rendered behind the 2D view, and
no setting in the editor, by default, can change that for 3D renderers. It is only available
for a 2D sprite renderer.
To resolve this, we need to apply a script to either the particle system itself or when we
play the particle system in the code. For simplicity's sake, I've implemented it as a script
on the particle system; this way, it is always in effect, and I do not need to worry about
configuring it.
So, create a new script called ParticleSortingLayer in Assets\Scripts and
replace its contents with the following:
using UnityEngine;
[ExecuteInEditMode]
public class ParticleSortingLayer : MonoBehaviour
{
void Awake()
{
var particleRenderer = GetComponent<Renderer>();
particleRenderer.sortingLayerName = "GUI";
Search WWH ::




Custom Search