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
Anchy
Anchyβ€’3d ago
do you have a stack trace / crash log?
Anchy
Anchyβ€’3d ago
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...
Anchy
Anchyβ€’3d ago
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
πŸ•Š ILoveBirds πŸ•Š
@πšˆπ™Ύπš„πš π™΅π™΄π™»π™»π™Ύπš† π™³πš„π™Όπ™Όπšˆ 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

Did you find this page helpful?