Unity Issue Tracker - Unsubscribing from "SceneView.duringSceneGui" in OnDisable() is ignored when unsubscribing more than once at the same time
Closed
UUM-25382
Unsubscribing from "SceneView.duringSceneGui" in OnDisable() is ignored when unsubscribing more than once at the same time
Unity: Scene View
Third Party Issue
2023.1.X
2022.2.X
2021.3.X
2020.3.X
The example code is incorrect. The line responsible for removing the "static" delegate is actually referencing an instance method. Changing the "StaticOnSceneGUI" method to "static" elicits the expected behaviour.
Reproduction steps:
1. Open project “TestProject”
2. Open scene “TestScene”
3. Make sure 2 Inspector windows are open
4. Select the “TestBehaviour” GameObject
5. Hover the mouse over the Scene view and observe the log message “On Scene GUI 1“ being spammed in the console
6. Deselect the “TestBehaviour” GameObject
7. Hover the mouse over the Scene view
Expected result: the log messages are no longer spammed in the console
Actual result: the log messages “On Scene GUI 0” is being spammed in the console