hi,
[unity 6 6000.0.32f1];
[adventure creator 1.83.0];
I have several layers for sorting:
I have a global variable called "TimeOfDay" with the values "day", "day_rain", "evening", and "night". When a scene starts, the current value of this variable is passed to a sprite animator called "view outside the window" in order to change the texture. The value is also passed to a global light animator in order to set the lighting based on the time of day.
To create a shadow effect in one part of the room, I have divided the room into different layers. However, there is a problem with sorting the character relative to the objects in the darkened area, as the character and the objects are on separate layers.
In order to solve this issue, I added a trigger at the entrance to the dark area that changes the sorting layer of the character's prefab to "ENV_ShadowArea" (props, player, NPC).
Is there a more efficient way to achieve this effect?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Are these Sorting Layers, or regular GameObject layers?
This sounds like more of a general Unity question, but URP's 2D Renderer has good lighting options - you could try making a light that affects characters but only in the bright areas of the room.
yes;
in fact, that's what I did, I have different global lights installed on different sorting layers; the question is, is this the right approach or not?
Sound like it to me.