Can't start unity while in debug mode Visual Studio.

After starting debug mode, for about 1 minute I can’t start the game. Is it only about 1 minute, but still it is very annoying;
I have heard to press “Attach to Unity and Play” but for me, it doesn’t work.

Also, when I wait and THEN start, almost always this happens:
9868683--1422423--upload_2024-6-2_14-48-16.png
I can debug normally, but it still loads.
note - I’m using debug mode, not release mode. Maybe this effects

You can also enter playmode, then attach the debugger. Unless you want to debug something that happens while launching.

Yes, I do want to debug something that happens in the first few frames, but you gave me an idea.
I can do something like this:

float debuggerBuffer;
udpdate()
{
     debuggerBuffer += 1;
     if(debuggerBuffer > 40)
     {
           doSomthing(); [breakpoints]
     }
}

So I can start the game, and then I have 40 frames that I can enter debug mode.
Is it more complicated then it should? Yes. Does it work? Probably.

Much easier:
Debug.Break();

This will pause playmode.

But how can I un-pause unity?
I still have the same problems, but instead of that I can’t press the start button, I can’t press the un-pause unity

Did you try “Resume” in the debugger?

Otherwise you can issue this in the Immediate window in the IDE:
EditorApplication.isPaused = false

From what I understand from your visual studio screen:
You have visual studio in debug mode, and it reached a break point executing the code.
This stops the code from executing, so Unity is frozen.
If you click on 9872328--1423194--upload_2024-6-4_14-23-8.png the code should start executing again and unity should unfreeze.
Or you can use f10 or f11 to advence the code step by step.

If unity is frozen when the continue button is greyed out 9872328--1423197--upload_2024-6-4_14-24-10.png, then their might be an error somewhere else.

If by “resume” you mean the continue button, then I can’t press the button in the debugger.
And by using
EditorApplication.isPaused = false
Then the game will automatically un-pause, so what is the point by pausing in the first place?

If visual studio is also frozen, then you might have a problem with one of your installs.

A less good, but working alternative would be to use Debug.LogError and check the “Error pause” button in unity’s console
9874677--1423797--upload_2024-6-5_18-11-55.png

Here’s a simplified way. Note that this will stop every 40 frames.

void Update()
{
    if (Time.frameCount % 40 == 0)
        Debug.Break();
}

If you want it to be a one time thing.

void Update()
{
    if (Time.frameCount <= 40 && Time.frameCount % 40 == 0)
        Debug.Break();
}