Disable Mouse Selection in Editor View

How I can disable Mouse Selection in Editor View for painting, editing an Object like in the Terrain Editor??

Calling this will do what you want :slight_smile:

public void OnSceneGUI()
{
    HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
}

Hello there, nice for the necro. :stuck_out_tongue:

The most precise answer I can give to myself (yeah) is this :

// Retrieve the control Id
int controlId = GUIUtility.GetControlID(FocusType.Passive);

// Start treating your events
switch(Event.current.type)
{
case EventType.MouseDown:
    //Treat your event
    
    // ...

    // Tell the UI your event is the main one to use, it override the selection in  the scene view
    GUIUtility.hotControl = controlId;
    // Don't forget to use the event
    Event.current.Use();
}

With this, you won’t be able to select anything in the scene while the object that lock the scene is selected. Change your selection in the hierarchy/project tab.