Hi, ive been putting together a really simple runner game with the help of AI. It was working great when all the roads segment pieces were in the scene, but since changing things so that the segments are loaded in on the fly, the shadows started behaving oddly, And no matter what I do, I cant seem to get the cars cast shadows to be crisp. Hopefully the video I attached helps the issue im seeing - but it’s a bit hard to explain.
No matter how I setup the cascades, the shadow always seem to be either sharp for the car and not showing up consistently elsewhere -or more. blurry allover. If I bring the shadow distance down, then the shadows start to disappear as the road progresses along.
From what I can gather, the issue seems to be around the dynamic loading of the segments. Would anybody know what might be doing on? or if its something thats just not fixable?
Can you run both techniques at once, eg, some placed in scene with functioning shadows and some loaded dynamically showing the problem?
If so, the problem is on the pieces so you can press PAUSE and explore the scene, comparing side by side.
If not then something else changed and you’d need to be able to compare to earlier versions of your game, perhaps by using source control if you’ve been tracking what you’re doing properly.
The main difference between the version that works and the version that does it that the old version has the road segments sat within the scene itself - and some code looped them. (image attached).
The new version doesnt have these segments in the scene itself, but instead loads them in at runtime, based off a list in a text file. There have been various changes to the code to accommodate this dynamic loading.
I’m saying get BOTH versions into a scene at once.
There’s only a few possible things that can happen:
neither has shadows
the old way has shadows, the new way doesn’t (this lets you compare each object in the scene by pressing PAUSE)
they both have shadows now
some other unholy combination of shadow and no shadow or shadow malfunction
Either way, you will move this bug forward. This is the essence of debugging.
Remember that you are gathering information at this stage. You cannot FIX until you FIND.
By debugging you can find out exactly what your program is doing so you can fix it.
Use the above techniques to get the information you need in order to reason about what the problem is.
You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.
Once you understand what the problem is, you may begin to reason about a solution to the problem.
Remember with Unity the code is only a tiny fraction of the problem space. Everything asset- and scene- wise must also be set up correctly to match the associated code and its assumptions.