Currently working on a custom editor script, my handles keep hiding when I select an other gameobject which doesn’t have the script attached.
The question has already been posted but I couldn’t find a proper (complete and well explained) way of solving this. I’m trying to get the solution posted by @whydoidoit to work, but as long as Sceneview is not documented I am still struggling!
Here is the solution, replace your OnSceneGUI() function with CustomOnSceneGUI()
using UnityEditor;
using System;
[CustomEditor(typeof(BaseClass))]
public class BaseClassCustomEditor : Editor {
void OnEnable()
{
SceneView.onSceneGUIDelegate += (SceneView.OnSceneFunc)Delegate.Combine(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(CustomOnSceneGUI));
}
void CustomOnSceneGUI(SceneView sceneview)
{
//Work here !
}
}
Thanks for spotting that I changed that part in my code now. I tried replicating this with if statements instead of switch case with the exact same result. Separating the switch case to its own method apparently also doesn't work.
This doesn't work for me, everytime I deselect my custom editor, the onDisable is being called. It just do its default behavior which is hiding when unselected.
Updated version: private void OnEnable() { SceneView.duringSceneGui += CustomOnSceneGUI; } private void CustomOnSceneGUI(SceneView view) { //your code here }
– xjjonDo you have any solution for showing multiple gameobject handles in the Sceneview ?
– SnazshThanks for spotting that I changed that part in my code now. I tried replicating this with if statements instead of switch case with the exact same result. Separating the switch case to its own method apparently also doesn't work.
– FranFyrhart