Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Restarting a scene while in debug mode (using vs)

Discussion in 'Code Editors & IDEs' started by belpory, May 27, 2024.

  1. belpory

    belpory

    Joined:
    Mar 21, 2024
    Posts:
    19
    I have a "problem" that drives me insane:

    how do I restart a scene in unity, through Visual Studio's debug mode?
    At first, I of course tried the restart button:
    upload_2024-5-27_14-28-27.png
    I have no idea what it does, but it certainly doesn't restart the scene.
    Every time, when I want to restart the scene, I have to:
    1. exit debug mode
    2. go to unity and close the game
    3. re-enter to debug mode
    4. re-open the game.
    This is VERY annoying.
    How to fix it?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,371
    VS does not directly give you any control over Unity's scene loading.

    Are you saying that you can't get the basic execution restarted after a breakpoint?

    Otherwise, you shouldn't need to disconnect the debugger... most of the time, as long as you can get your breakpoints out of the way "enough" that Unity can freely run, then you press STOP/START and off you go. :)
     
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,932
    You implement a method that reloads the scene.

    Most easily with a component that (only in DEBUG builds) reloads the currently active scene when the user presses Ctrl+R for instance.
     
    bugfinders likes this.
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,689