Halo hidden under the sprites
Hello!
I am a Unity3D beginner and trying to create a 2D game. I have prepared a small test scene and decided to work a little bit on the visual effects for the player character and then a problem occured.
My player character game object has a Halo component (I have also checked with Light with halo turned on, the effect is the same regardless). Although the the Halo renders, it shows behind the sprites of other game objects in the scene. Manipulating the Sprite Renderer's Sorting Layer and its order does not change anything (and I don't think it should, since this is a renderer for the sprite) - every other object has its sorting layer set to "less visible" (the character sorting layer is "on top" of all of them, meaning it is on the end of the list of Sorting Layers).
So, is there any way to allow the order manipulation on the light rendering within a 2D scene? I have to mention, that I've tried custom scripting fix just like in http://answers.unity3d.com/questions/577288/particle-system-rendering-behind-sprites.html but this way is considered obsolete by the Unity3D editor compiler.
Best regards!
Could you post pictures of how your error looks like and what effect are you trying to achieve?
As you can see on the picture, the halo itself is rendered, but things in background (both ground and trees) are not behind the rendered halo, but on top of it. I would like to have this halo rendered on the same sorting layer as character sprite is. Is it doable?
Does it need to be halo component? Can't you just draw 'halo' as a sprite (maybe add some self-illu$$anonymous$$ation to it) ins$$anonymous$$d? Alternatively, if you want to produce a fog-like effect that will be there throughout the entire level, you can just create a 'filter' -- sprite, or semi-transparent UI element which will be a child of camera, with sprite, you can set up it's 'depth' in sort layer, with UI element it's gonna be rendered in front of everything I believe
I think the halo effect is not 2D in unity (again that's just my impression), so you might try to attach it to separate object and move its Z-axis, see if it changes anything
I have to admit, that this may be the case - Halo may simply not be the "2D" component. When switching view to "isometric", I can see that halo (both basic one and this one included in "Light" component) are shown at some different Z coordinate. Unfortunately, changing Z does not change a thing, since sorting order has a priority when evaluating rendering hierarchy. This means, that the best way to deal with it for now it to use sprites and animate them, but... there's gotta be a better way, and if I find it, I'll put it in this thread.
Thanks for your help @ex3me !
Answer by NGGProgress · Oct 09, 2019 at 11:22 AM
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.
Answer by zbrtcchr · Jan 24, 2016 at 09:12 AM
Hi @Olhur , has a solution been found for this problem?
Hi @zbrtcchr, unfortunately we are still having the same issue, also with other 2D Renderers (i.e. Line Renderer) - no solution for now, we have only partially replaced some effects with animated sprites.
Best regards!
Answer by Beastman632 · Feb 12, 2018 at 10:46 PM
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.