The bug:
If I “transform.rotate()” my ‘sun’ (a directional light with frame updated shadows) on a release BUILD copy of the game it crashes immediately. (unity crash window) If I use the editor or do a ‘developer’ build it runs fine. (the transform.rotate line itself is not erroring… it appears that it’s when the frame rendering takes place that it actually crashes. But, if I comment out the rotate, it will not crash, and the next frame renders correctly.)
The weirdness:
Only 1 computer is experiencing this crash. An old intel core i7 950. The game was running fine on this computer PRIOR to upgrading to Unity 6. (unity 2023.2.18f1 was the last one i used before moving to unity 6000.0.30f1 in dx11.) And as stated above, if I run a developer build it has no issues. And no modern cpu has had any issues. (I know its not gpu related, as we have gtx 1080 in it, and it runs fine on a 1080 with a more modern cpu) (and yes, drivers are up to date across the board)
Summary:
So the issue is related to this old cpu, rotating/moving a directional light with shadows, on a release BUILD version of the game. (not in editor or dev mode)
It would be very helpful to have more information such as the code in question…
If you’ve truly ruled everything else out you should make a minimum reproduction project and submit a bug report.
If you’re not positive it’s a bug with Unity I would recommend posting the code in question so people can take a look at it and maybe help you understand what may be happening… many things can change between the editor and developer/release builds including order of execution (things may be initialized in the editor earlier for whatever reason, but later in the build causing null reference exceptions, etc.)… the list goes on and on, without more information it’s hard to make specific recommendations.
Some important things to look out for are execution order and places where any ‘sketchy’ serialization techniques are used that make not translate well to builds, amongst many other things… since the issue only happens in release builds for you it may be worth looking at places where things may be getting optimized away due to the compiler thinking they’re unused… if you’re invoking code that exists in DLLs, etc, make sure you have correct assembly definitions or anything else neccesary to ensure key things are not being optimized away causing null reference accesses, etc.
I’ve seen similar issues occur where people use singletons and/or static classes in a way that works in developer builds, but not in release builds as the relevant stuff is ‘optimized’ away by the compiler. Without more info on your project though I can really only offer these generic suggestions.
It’s only crashing on 1 old machine. Works fine on 100s of others. This is the line I can comment out and have it working for the 1 machine that doesn’t. (but then I lose my day/night cycle)
The next step would then be to make a minimum reproduction project where you only invoke the code in question on the same Unity version on the same device… this will let you know whether the issue is with Unity 6 in general, or your project specifically…
Even if the issue doesn’t occur in this minimum reproduction test it doesn’t rule out it being a Unity 6 bug, but it would heavily lean towards it being a project specific issue instead.
If you’ve directly tested the builds on other CPUs (the exact same build with the exact same build settings) then it’s likely a bug and it’d be important to share our whole project, or a minimum reproduction project with Unity in your bug report… really at that point you should just move straight to bug report… I think it may be worth considering adding some logging though first to ensure that ‘sunTransform’ is not null in your release build for whatever reason if it’s crashing on such trivial code as it’s unlikely that software as mature as Unity 6 would have such a trivial bug (in my opinion).
I would strongly urge you to check and re-check things you think you know about the issue and try to prove yourself wrong… it can be easy to let confirmation bias set in and lead you down a long unnecessary rabbit hole.
I also placed debug messages through all of my code, and every one is being triggered correctly. Then the frame is rendered and the crash occurs. I also created a delay timer to not move the sun for the first 30 seconds upon entering the scene. Crashes as soon as it hits the sun rotation. (also have a null check before)
Strange… I just disabled ‘Realtime Global Illumination’ within the lighting settings and now its working great on the release build. ( possible this old cpu doesn’t support this?? but then why doesn’t it error in a dev build? )
Glad to hear it’s solved! Based on the stack trace it definitely seems to be a Unity thing… my guess is the global illumination in Unity 6 uses some instruction set like AVX or AVX2 that is not supported by that old CPU… honestly this seems like it may in fact be a bug.