Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Visual Studio Debugging Unity freeze

Discussion in 'Scripting' started by BenVenNL, Dec 23, 2019.

  1. BenVenNL

    BenVenNL

    Joined:
    Oct 14, 2019
    Posts:
    56
    Is there a way to get the line of code which makes Untiy freeze when using Visual Studio on Windows?

    I have a situation where sometimes Unity freezes.

    It probably isn't a random thing, but I can't figure out when this happens. What combination of things causes Unity to freeze.

    I have to do some random clicking in my scene for a while before it happens (and sometimes it happens right away). Stopping the code everytime at mouseclick input will take a while.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,522
    Unity will freeze if you do a busy loop without yielding, something like:

    Code (csharp):
    1. while (true) {
    2. // stuff here
    3. }
    is explicitly forbidden, unless it is in a Coroutine AND you yield within that loop periodically.
     
    Joe-Censored likes this.