Shadows casting incorrectly after building

I’m having a weird issue where everything in my scene seems to be casting its shadow at an incorrect place (as seen in Screenshot1), but this only seems to be happening after a build. Inside the editor the preview is fine (as seen in Screenshot2). Has anyone seen this before? Or have any ideas on how to fix it?

I actually originally thought everything in my scene was floating/hovering because of the way the shadows are casting, but after closer inspection it seems like its just a shadow issue.

Weirdly enough I have two levels doing this, and two that are completely fine. And I’ve built them all in exactly the same way (as far as I know!).


You seem to be having the same issue as on this thread Problem with shadows - Unity Engine - Unity Discussions. We weren’t able to figure it out there either; by chance is the ground there a Terrain?

Yes, its using Terrain. The weird thing in my case is that I have two levels that I’ve built in exactly the same way and they don’t have the issue…

I’ll try a couple of the steps you’ve mentioned on that thread and report back!

No luck disabling static mesh optimisation :frowning: But I did spot something else that Huruk_an mentioned on the other thread. If you look near the bottom of the attached pic (Screenshot3) I’ve circled an asset that I dragged under the ground, and you can actually see the shadow on the surface?! Very weird.

Yeah, it kind of looks like everything is casting shadows on the terrain as if it were several meters higher than it actually is. Have you also tried replacing the terrain with just a normal mesh (even a flat plane will work, just for testing), to see if the shadows come out right then? It could narrow the problem down to being either with the terrains or with shadow casting in general.

As I mentioned in the other thread, this is probably worth submitting a bug report for, if you can. Especially since now that’s two different projects with the exact same issue.

I’ve found a possible solution. If you select the terrain, go to Terrain Settings → Base Terrain → Change ‘Material’ from ‘Built in Standard’ to ‘Built in Legacy Diffuse’.

The shadows look fine now :slight_smile:

Ill post this on the other thread to see if it fixes Huruk_an’s issue too.

Nice! Sounds like it is a problem specific to Terrains after all. Glad you were able to find a workaround.