Search Issue Tracker

Fixed in 2022.1.X

Fixed in 2021.1.X, 2021.2.X



Found in



Issue ID




GUIStyle errors are thrown when entering Play mode with docked Profiler and the "Maximize On Play" option Enabled



To reproduce:

1. Download the attached "" project and open in Unity
2. Open the "SampleScene" scene
3. Open Profiler window and dock it near Console or anywhere else
4. In Game View enable the "Maximize On Play" option
5. Enter Play mode

Expected Results: Everything works as Expected
Actual Results: Errors are spammed in Console:

"Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI
UnityEngine.GUIStyle:op_Implicit (string)
UnityEditorInternal.ProfilerTimelineGUI/Styles:.ctor () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPU/ProfilerTimelineGUI.cs:210)
UnityEditorInternal.ProfilerTimelineGUI:get_styles () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPU/ProfilerTimelineGUI.cs:231)
UnityEditorInternal.ProfilerTimelineGUI:InitializeNativeTimeline () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPU/ProfilerTimelineGUI.cs:2673)
UnityEditorInternal.ProfilerTimelineGUI:Clear () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPU/ProfilerTimelineGUI.cs:1348)
UnityEditorInternal.Profiling.CPUProfilerModule:Clear () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPU/CPUProfilerModule.cs:92)
UnityEditorInternal.Profiling.CPUOrGPUProfilerModule:OnDisable () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPUorGPUProfilerModule.cs:308)
UnityEditorInternal.Profiling.CPUProfilerModule:OnDisable () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/CPU/CPUProfilerModule.cs:81)
UnityEditor.EditorApplicationLayout:InitPlaymodeLayout () (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/EditorApplicationLayout.cs:59)"

- This issue appears both on Windows and OSX
- This issue is not reproducible when Profiler is undocked and the "Maximize On Play" option is Enabled/Disabled
- This issue is not reproducible when Profiler is docked and the "Maximize On Play" option is Disabled
- Sometimes Unity on MacOS throws different Errors:

"NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ProfilerWindow.SaveViewSettings () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerWindow.cs:682)
UnityEditor.ProfilerWindow.OnDisable () (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/ProfilerWindow/ProfilerWindow.cs:367)
UnityEditor.EditorApplicationLayout:InitPlaymodeLayout() (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/EditorApplicationLayout.cs:59)"

"IConnectionState was not Disposed! Please make sure to call Dispose in OnDisable of the EditorWindow in which it was used.
UnityEditor.Networking.PlayerConnection.GeneralConnectionState:Finalize () (at /Users/bokken/buildslave/unity/build/Editor/Mono/Networking/PlayerConnection/AttachToPlayerGUI.cs:373)"

Reproducible on Unity 2021.1.16f1, 2021.1.21f1, 2021.2.0b11 and 2022.1.0a8
Not reproducible on Unity 2019.4.30f1, 2020.3.18f1 and 2021.1.15f1
Regression on Unity 2021.1.16f1

Comments (5)

  1. Cefef7ef97e1af2fd34406a315aa1e51?d=mm


    Oct 21, 2021 10:58

    Exact same scenario that has been spelled out below. Luckily, it doesn't seem to cause any breaking issues - not in my scenario at least.

  2. D24fd70d5e83c6419547e31b526f46a3?d=mm


    Oct 11, 2021 17:12

    I am using 2021.1.24f1 and also has the ONGUI error. The only way I can get it to stop is too close the profiler. If I then restart the profiler it does not give the error unless I dock it to any window. As long as it is open in its own window there is no error. I agree with GASPEDAL it sound like a bug.

  3. 6089d23d047805afcc837d5f48ff011d?d=mm


    Sep 30, 2021 19:58

    I get this issue on 2021.1.16f too. Entering Play Mode with Profiler docked and Maximise On Play option selected returns the above errors.

    Not having Maximise On Play turned on seems to stop errors.

  4. Ef94817381468f6954ef6738022bdabb?d=mm


    Sep 30, 2021 06:25

    I'm using Unity 2021.1.19f1 on a Windows 10 PC. This issue showed up after I started using the profiler about 3 or 4 days ago. I may have had the game window on Maximize On Play at the time, but the Profiler is currently docked and Maximize On Play is not selected. The errors still populate every time I play the game.

  5. 1143c6ede1698fadfc41a900aa456242?d=mm


    Sep 11, 2021 21:11

    Same here with 2021.1.16f
    Even when I create a new empty 3d project and click on "play" , I get this GUI Error Message.
    Seems like a Bug.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.