Search Issue Tracker
Fixed in 2021.1.X
OnSceneGUI is not being called when using a certain layout
1. Create a new project
2. After Editor loads shut it down completely
3. Open project root and navigate to Library folder
4. Replace "CurrentLayout-default.dwlt" with the one attached in edits
5. Open the project again
6. In the scene create a new empty GameObject at (0, 0, 0)
7. Attach the "SceneGUIExample.cs" script to the object
8. Select the GameObject and inspect the Scene
Expected result: OnSceneGui is called and there is a rectangle wireframe in the scene at GameObject's position
Actual result: OnSceneGui is not called and there is no rectangle wireframe in the scene GameObject's position
Reproducible with: 2021.1.15f1
Not reproducible with: 2018.4.36f1, 2019.4.29f1, 2020.3.14f1, 2021.2.0b4, 2022.1.0a3
1. looking at a diff tool the layout file where the issue reproduces is mostly different in some of the values (not by a great margin). Some lines seem to be missing, though the file does not appear corrupted or anything of the sort.
2. I am not sure if the issue here is OnSceneGui not working with the layout, or the layout being somehow edited during the game creation process so that the issue starts reproducing.
3. An upgrade of the project might resolve the issue, but I did not find it consistent
Nov 27, 2021 21:04
Another workaround/fix is to save your current layout, and reloading it.
I used 2019.4.10f1
Oct 08, 2021 11:26
This happens when the last (going from left to right and top to bottom) inspector in the layout is a "debug" inspector. Still reproducible in 2021.1.24f1.
Workaround that helps me: I have a left and a right inspector. Usually the "normal" inspector is on the left and the "debug" inspector is on the right. Switching them around (just change their type in the view's menu) lets OnSceneGUI be invoked again. No new layout or tab closing required.
Aug 07, 2021 07:26
THANK GOD SOMEONE FOUND A WORKAROUND!!
Been searching around on google for days!
Jul 28, 2021 19:03
Workaround for users stumbling upon this until this is fixed:
a. Load another layout (a previously saved one if you know it's not corrupted, or a default one)
b. Close *all* Inspector tabs, and reopen one
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [Linux][IL2CPP] Player is not killed when using xkill command
- Decal is not drawn when using Deferred Rendering, a Rendering Layer, and Screen Space Ambient Occlusion
- "unity-radio-button-group__container" element is not referenced when calling RadioButtonGroup.contentContainer
- Unclear documentation about when ScriptableObject.Awake() is called
- [Windows] UnityPluginLoad is not called when the Native plug-in is embedded
Resolution Note (fix version 2021.1):
Fixed having 2 inspectors (1 Normal and 1 Debug) open on the same object causing inconsistent behavior regarding the call of OnSceneGUI and other Editor scripts methods.