I’m just going to start off with saying: I have no idea what I am doing at the moment.
I am working in 2D. I have a particle effect with a Halo effect added to it. I cannot get the Halo effect to render in front of the sprites. I used a script to get the particle effect up front, but I can’t figure out how to do it with the Halo effect. Here’s the script.
using UnityEngine;
using System.Collections;
public class SpecialEffectsLayer : MonoBehaviour {
private Component halo;
// Use this for initialization
void Start () {
halo=gameObject.GetComponent("Halo");
halo.renderer.sortingLayerName = "2nd Foreground";
}
}
I’m sure I’m butchering the syntax.
I saw a few different questions on here involving referencing the Halo, but they all have to do with enabling and disabling it.
Here is an image of what it looks like currently (as well as the Inspector). You can see the particle effect is in front, but the Halo is not.
You can attach the halo as a separate component or creatie tour own script to place a 2d texture on te location of the light. Then move this texture to a higher draw layer.
It seems the shader the Sprites - Default material uses causes this behaviour. Create your own material and set its rendering mode to Cutout and shader to standard. This will allow halos to show in front of your sprites.
I fixed this problem by creating new material for the sprite behind which the halo was hidding. The new material was: Shader: Mobile/Particles/Alpha Blended, Render Queue: AlphaTest - 2450. This material does not affect the quality of the sprite and makes the halo gameobject visible. I am using Unity 2018.2.20f1.