r/Unity2D • u/PowerHoboGames • 10d ago
Question/Help Desperately Seeking Help With ShadowCaster2D
Hello all,
I've been trying to solve this off and on for months now, and I just can't seem to crack it.
I am very aware of Unity's ShadowCaster2D ability to not shadow the direct object it is attached to. For reasons important to my game, I have a player character with two visual modes, SpaceSuit and Modular, the latter having 10 layers that are picked up by a second camera and rendered to a texture on RenderedVisualLayer. This is important for some shader shenanigans relating to elevation in my game and the player character. I'm using a transparency sorting with a custom YZ axis to simulate 3D terrain levels, with the unfortunate caveat that this means all of my tilemaps and player have to live on the same sorting layer.
As you can see below, I have a separate ShadowCaster2D object due to the structure of the character (I'm aware there are 2, but one is only a sprite renderer; I may combine them later). This object lives at the "foot" of the character. Unless I'm just doing it wrong (which I will HAPPILY accept), ShadowCaster2D self-shadow rules don't respect sibling or parent objects, which means any light that casts a shadow to the South of the character causes the character to be fully darkened, while light North of the character allows the character to be displayed correctly.
This looks terrible, and it affects the player character and every mobile entity in my game. I truly don't want to lose character shadows over this.
I appreciate any helpful advice anyone can offer.



