SetPausemodeLayout() getting called whenever Debug.Log() is used

OK today out of the blue I was doing what I normally do, just working on my game (This project is > 10 years with over 100k LOC)

suddenly the editor paused when I press Play because of the Unity Editor Function SetPausemodeLayout()
weird, try it again, same thing … recheck what I was working on, nothing important, restart unity, same thing, it pauses
I tracked it down to it getting called whenever there is a Debug.Log(), print(), Debug.LogFormat() etc
OK I reboot the PC, Problem still persists,
I try a totally separate scene from different scene, it also stops at SetPausemodeLayout() when Debug.Log()
Gah so Unity has somehow become corrupted!
Anyone seen anything like this before and how to proceed?

Right now
I’ve made a backup, and now are installing Unity 6 latest recommended version, and are going to see if it works with that, not happy cause I know from experience, a lot of things are prolly gonna break. FWIW I was using 2022.2.20

Any other advice, perhaps I somehow switched on something inadvertently in the editor? I’ve googled (even asked chatgpt) seems this problem hasn’t occured before, btw I did try Reset editor layout etc

cheers Zed

EDIT: Wow upgraded to latest Unity version and its still happening!
I press play and it’s pausing here
UnityEditor.EditorApplicationLayout:SetPausemodeLayout ()

Why? How can I possibly see whats calling this?

Last lines from editor Log

000.0 1 OnApplicationFocus:False
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
GLOBALS:Log (string) (at Assets/CLASSES/App.cs:979)
App:OnApplicationFocus (bool) (at Assets/CLASSES/App.cs:528)
UnityEditor.PlayModeView:SetFocus (bool)
UnityEditor.GameView:OnLostFocus ()
UnityEditor.HostView:OnLostFocus ()
UnityEditor.HostView:DeregisterSelectedPane (bool,bool,bool)
UnityEditor.HostView:SetActualViewInternal (UnityEditor.EditorWindow,bool)
UnityEditor.DockArea:SetSelectedPrivate (int,bool)
UnityEditor.DockArea:set_selected (int)
UnityEditor.EditorWindow:ShowTab ()
UnityEditor.WindowLayout:TryFocusAppropriateWindow (bool)
UnityEditor.WindowLayout:ShowAppropriateViewOnEnterExitPlaymode (bool)
UnityEditor.EditorApplicationLayout:SetStopmodeLayout ()
UnityEditor.EditorApplicationLayout:SetPausemodeLayout ()

OK Think I’ve solved it
I must of clicked on ‘Error Pause’ by the console window - Duh

IIRC I had the same problem some years ago, and IIRC it took me some hours also to track down what happened.
Well at least it got me to update to the latest version of Unity : Though quite weather of not its better than 2022.2 is yet to be seen

1 Like

I recommend sticking this in your code

void OnApplicationFocus( bool hasFocus )
{
	Debug.Log( "OnApplicationFocus:" + hasFocus + " if this is stopping editor make sure Console 'Editor Pause' button is not checked");
}

At least this gave me a reason to update Unity, and so far nothing major seems to have broken (surprised a bit)
AFAIKS, 6000 seems to be about 1% faster running in editor (haven’t done a build yet), editor startup is about 30% quicker as well.

Looks like I spoke too soon,
seems as if its caused by motion blur (btw camera is not moving). Performance is really bad as well.
Theres always something

the above is 6000

Just fired up unity 2022.2.20

Guess I wont be using unity 6 at all :slight_smile:

I hope you are not bunny-hopping Unity versions with the same project.

If you do that, worst case is it could destroy your project or parts of it when opening a project in an older editor version! This is not supported.

When upgrading the editor and you run into any inexplicable issues, be sure to delete the Library folder and try again.

1 Like

Cheers Steffen, no over the years I’ve only gone to higher versions of unity (never downwards)

what I did was just copy the following directories into a new Main Directory

Assets
Packages
ProjectSettings
UserSettings

I believe this is the minimum you need to copy over

and load this up in Unity 6000, thus everything gets rebuilt from scratch (takes a couple of hours)

The original 22.2.20 version I left untouched