Game Crash On Scene Load
Hey, so I'm kind of new to coding, and I need some help with my script-
when ever the scene attempts to load, my game just flat out crashes, and I can't seem to figure out why? So if anyone has a solution, I would be glad to hear it.
I've attached my script if anyone needs to look at it, as I've been trying to fix this for a month now.
7 Replies
do you have a stack trace / crash log?
Nothing comes through the console
if you are on Windows you might be able to retrieve it through the Event Viewer app
or possibly some log file in the game directory
another thing you could do is attach the debugger to the game and that should catch the exception if you arent already catching it
The script is for my VR game: So when I play in VR, it just crashes, but when testing in the editor, no errors come up, and nothing crashes...
ah I am not familiar with debugging VR or games in general really, is this a Unity game?
you'd likely get better help over at the Unity Discord if that is the case: https://discord.gg/unity
Ok, but yes, my game is made in Unity
@ππΎππ π΅π΄π»π»πΎπ π³ππΌπΌπ in your while loop there is no if condition, meaning ur while loop executes once if ur condition is true because your returning null, also in the loop why set state variable? its declared within the scope of "if (animator != null)"?, also the rest of the code is unreachable because ur returning null, if u wanna break a loop use 'break;'
if u wanna check when a animation is finished, use something like 'yield return new WaitUntil(() => animator != null && other conditions....)'
P.S: use unity forums scripting section where other unity devs can answer your question