The shadow works as intended with most slopes (still doesn’t work 100% on 45 degree slopes, but I think I can just avoid them in level design).
I had to basically rip the code out from individual objects and throw it all into a single script to make sure everything happened in the right order before each frame updated.