Search Issue Tracker

Fixed in 2021.1.X

Votes

2

Found in

2021.1.7f1

2021.1.15f1

Issue ID

1340534

Regression

No

OnSceneGUI is not being called when using a certain layout

Scene/Game View

-

Reproduction steps:
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

Note:
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

  1. Response avatar

    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.

Comments (4)

  1. 2e6eb137e9123ebf62e03e3876c960e9?d=mm

    SupremeCookieDev

    Nov 27, 2021 21:04

    Another workaround/fix is to save your current layout, and reloading it.
    I used 2019.4.10f1

  2. 7c78476aa3eccf92fbaf28c84a4b4c10?d=mm

    dm_RobL

    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.

  3. Cb40badee94f1a066d7a8e9caae50131?d=mm

    FMT_WL

    Aug 07, 2021 07:26

    THANK GOD SOMEONE FOUND A WORKAROUND!!

    Been searching around on google for days!

  4. E6a7b77eca37855c736c62d938515b5a?d=mm

    huulong

    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

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.