Search Unity

How to disable selection other objects in scene view, (like edit-mode in LightProbeGroup inspector)

Discussion in 'Immediate Mode GUI (IMGUI)' started by Kichang-Kim, Dec 21, 2018.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    250
    Hi. I'm trying to implement my own point-editable inspector, like Unity's LightProbeGroupInspector.

    I found that LightProbeGroupInstpector.cs, PointEditor.cs and so on in UnityCsReference. It provide many usefule information for implementing this.

    But I can't found how to prevent selecting other object when I editing points.

    In edit mode of LightProbeGroupInspector, mouse click of scene view only allows selecting the point of light probe, and clicking on other object is safely ignored.

    How to implment this behaviour?

    Thanks.
     
  2. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    250
    I found that
    Code (CSharp):
    1. int id = GUIUtility.GetControlID(FocusType.Passive);
    2. HandleUtility.AddDefaultControl(id);
    3.  
    is working solution.