Hello, Im using 2d Lights and bloom and shaders and have an issue, where my Healthbar sprites turn dark when i kill the other enemys and only one is left (first Picture). The Second picture shows the dark Healthbar after one of the Enemy-Prefab ist remaining. (I also attached to every Sprite in the scene NormalMap, if this is useful)
I don’t have any clue, but I would check my game for overlapping sprites, check the scene without light, check where the light hits, maybe it is some shadow thing, maybe it is some instanciate thing. …
Pause you game when the bug occurs and check your scene for strange behaviour. Put things on/off to see if something affects the healthbar.
If I disable the USE NORMALMAP in my lightsource, everything is working fine. But i would like to use Normal Maps for my game. I also noticed that only the Red Health status Sprite turns dark (healthbar is made out of a border, red health status bar, background).
So this mistake occurs only at your sprite that is red?
yes
Do you have more than one lightsource that uses NM? If you put one off, does the bug still occur? Maybe they add or multiply each other.
I don’t think that the bug occurs only at the red-sprite. Create a completely white-sprite and test that .Change its color in the spriterenderer to red, green, blue, yellow, … and test it out during runtime.
My ideas are:
there are 2 or more layers overlapping
some sortinglayer orders
shadow or shadowreflection
lightsources add eachother
forgotten to instanciate a value
a winscreen that pops up if the level is completed, that “masks” the healthbar, too
otherwise I don’t know what it can be.
I will try it
Thank you for your time and effort! I finally found the suprising problem. I scaled the red bar according to the enemy’s health with: Vector3 (variable, 1f). But i have to scale it with Vector3 (variable, 1f, 1f). instead Z would turn to 0 and the sprite would go dark.