I am running Unity 5.
I am using a directional light with hard shadows enabled.
The shadows are real time and render just fine in Game View and when playing the game inside the editor.
However, when I build and run the .exe, the shadows are nowhere to be found.
I went to window and set my directional light as the sun, tried deleting my directional light and making another, and made sure my graphics settings had shadows on. I also checked my objects and yes, they are set to receive shadows.
Is this a Unity 5 bug? Is my file corrupted? I have no clue how to fix this issue.
Thank you for your time and help.
So I just had this problem on Unity 2019 and this was the first google result so let me note the answer for the issue here.
Under Build Settings, go into Player Settings, then into Quality. There is a grid at the top, click the arrow next to Default and change it from Fastest to something else (i.e. Fantastic).
You should probably aim to then have this selection available to the users in a menu, somewhere down the line.
FIXED! Okay, so I fixed the issue. It was a combination of a couple things. First I changed my single directional light to rendering mode: IMPORTANT. Then I changed the rendering on the camera I think to deferred rendering which fixed shadows on certain objects, but still not my player. The biggest fix was the shader on my objects. I was using pre made textures from a pack and after I changed the shader to a stock unity specular, it appears to be working when I build it. Thanks so much team
@senzor In my case, it was automatically changing quality settings from Fantastic to Fastest in build. So changed it again to Fantastic from script (Ex : QualitySettings.SetQualityLevel(5)). 5 is id for Fantastic.
Deleting all quality settings except Fantastic also resolves issue.
In my case the solution was just to increase the rendering quality (drop down selevction when starting the .exe).