- Home /
Shadows and ambient occlusion post processing don't work... until I click on the shader
So this is a super weird error. We're working on a city building type game, and I'm working on getting shadows to appear. I've set all our buildings and ground plane to be light map static, and set the light to cast shadows. The buildings receive shadows ok, but the ground plane doesn't.
The weirdest part is if I click on the ground plane's shader in the inspector, suddenly the shadows appear. It's like the light maps are being recalculated when I click on it or something? Our buildings are generated procedurally at runtime, so I'm thinking it might have something to do with that? But I'm wondering if anyone has any ideas what may be happening, and how we can get shadows to appear reliably.
Answer by AdamBL · Aug 02, 2018 at 07:05 PM
Update: I figured out a solution, but I'm still not sure why it was a problem. The way we were setting the material for the map tile was:
material = new Material(Shader.Find("Standard"));
but by creating a public variable for a material called mapMaterial
and setting it via:
material = mapMaterial;
it works.
If we did want to create the material procedurally, is there anything we would need to do to that material
to make it accept shadows?
Your answer
![](https://koobas.hobune.stream/wayback/20220612172059im_/https://answers.unity.com/themes/thub/images/avi.jpg)