Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Debugging errors after update

Discussion in 'Scripting' started by BrandonK, Nov 22, 2016.

  1. BrandonK

    BrandonK

    Joined:
    Sep 18, 2015
    Posts:
    41
    In my current project, I have created a level handler along with an editor script. Both of these worked flawlessly, until I updated unity to version 5.4.3f1. Now it has a really bad bug, that I can't seem to fix. Whenever I set the current level to my menu level (no matter how I do it through hard code or with a button etc.), unity closes instantly, as if I closed the application myself. It doesn't even log an error when doing so. I'm not going to post my scripts (it's over 2000 lines of code), but has anyone even had similar bugs, or any suggestions on how to work at this. Is there any way to see what caused unity to close (like what function, line of code), some sort of crash log or something.
     
  2. Timelog

    Timelog

    Joined:
    Nov 22, 2014
    Posts:
    528
    Have you tried to place a breakpoint in all relevant scripts and run through it with the debugger to see when exactly Unity is closed?
     
  3. BrandonK

    BrandonK

    Joined:
    Sep 18, 2015
    Posts:
    41
    Thanks, I just tried that now. In my editor script I assigned the level through code with a breakpoint. Then in visual studio I attached to unity, it stopped at the breakpoint where I assigned it, I clicked continue multiple times to reiterate through the script (because this was in the OnInspectorGUI function) unity hadn't closed, but it was unresponsive and i couldn't do anything. As soon as I hit the button to stop debugging (in visual studio) unity closes???
     
  4. BrandonK

    BrandonK

    Joined:
    Sep 18, 2015
    Posts:
    41
    I think something is corrupt, but I've tried removing and re-adding as a new component but I still get the same results.
     
  5. Timelog

    Timelog

    Joined:
    Nov 22, 2014
    Posts:
    528
    Try to step through the code instead of continuing (F11) and see at what point it becomes unresponsive.
     
  6. BrandonK

    BrandonK

    Joined:
    Sep 18, 2015
    Posts:
    41
    Thank you that was very useful, I seem to have created an infinite loop in my serialization. Although when I've created infinite loops in the past normally unity just freezes, have you got any idea why this closes it instantly? It's also strange that I haven't changed the code and this worked before.