Search Unity

Debugging without Unity freezing?

Discussion in 'Editor & General Support' started by HeaDiii, Feb 4, 2018.

  1. HeaDiii

    HeaDiii

    Joined:
    May 18, 2015
    Posts:
    61
    Hey there,

    I want to debug my code but unfortunately Unity freezes during the debugging is in progress. Is there something i could do so that Unity does not freeze and I can check the hierarchy and inspector? I don't care if the game-view stops or not.
     
  2. samuel85C

    samuel85C

    Joined:
    Feb 3, 2018
    Posts:
    8
    I doubt this has something to do with your CPU or your RAM, and luckily, you aren't the only one to have this similar problem. In my opinion, if you have any Breakpoints when you're debugging, it is recommended to remove them if possible. Breakpoints can freeze the application depending on what your PC likes and what it doesn't like
    In fact, even my PC hates something: Fonts.
    But, anyway, please tell me as soon as possible, what version of Unity you're using.
    (If you want to still keep the Breakpoints, it is recommended to change the breakpoint settings by right-clicking your breakpoint and clicking on "BreakPoint Properties")
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,519
    Post some code thats freezing.
     
  4. samuel85C

    samuel85C

    Joined:
    Feb 3, 2018
    Posts:
    8
    Good idea LaneFox
     
  5. HeaDiii

    HeaDiii

    Joined:
    May 18, 2015
    Posts:
    61
    Maybe "freezing" was not the right word for this. When I'm using breakpoints in my code and the application reaches them, Unity stops for as long as i don't press continue in my IDE. For the duration the application/execution of the code is stopped, i would like to browse through my Unity-Hierarchy, which is not possible because unity waits for my code to continue. As soon as i press continue (and don't hit any other breakpoints), Unity behaves as normal.
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    This would be very useful indeed. Unfortunately, it isn't supported.
     
  7. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    The "Freezing" is a intended behavior. If you would not stop the application that you are debugging you could not view the state of the app when it reached the breakpoint.

    If you do not need to use the debugging feature and just need the application (not unity editor) to pause after that frame, you can use Debug.Break() .
     
    HeaDiii likes this.
  8. HeaDiii

    HeaDiii

    Joined:
    May 18, 2015
    Posts:
    61
    I know this is an intended behaviour, but I think it would be more useful if only the application itself would pause instead of everything.

    Debug.Break() seems to be pretty handy for some kinds of debugging stuff but i think it could be obstructive when being used a lot in loops or large functions. Also, i don‘t have any access to the debugging features my IDE offers when using regular breakpoints (as you mentioned)
     
    Last edited: Feb 8, 2018