Keep custom handles always visible in editor

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!

Well, I got it to work !

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, you also need to remove the callback when done:

 private void OnEnable()
 {
   SceneView.duringSceneGui += CustomOnSceneGUI;
 }
  private void OnDisable()
 {
   SceneView.duringSceneGui -= CustomOnSceneGUI;
 }

 private void CustomOnSceneGUI(SceneView view)
 {
   //your code here
 }