Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request Need access to "Selection Outline" toggle from script

Discussion in 'Editor & General Support' started by EidLoi, Sep 25, 2022.

  1. EidLoi

    EidLoi

    Joined:
    Nov 20, 2019
    Posts:
    3
    Ahoy,

    I am working on tooling to edit a 3D tile grid and I need to control this toggle from script:

    Screenshot_76.png

    Issue: when I select my tile grid Unity outlines the whole thing and there are 5k+ renderers inside. This is a huge performance hit for no particular reason as the outline is out of screen most of the time.

    Context: EditorTool relies on a type, either a MonoBehavior that needs to be selected or the SceneView. However, if I rely on the SceneView, I also need to rely on the physics world of it (which may or may not be available depending on the stage) and figure out if the object below the cursor is my grid or not. ("HandleUtility.PlaceObject" doesn't tell what object I am placing on so I can't use it to lock onto the grid.)

    The outline is great for cases when a single tile is edited, so I would like my tool to toggle the outline off when it is activated and re-enable it when the tool is deactivated.

    I found that the SceneView relies on an internal "AnnotationUtility.showSelectionOutline", but it would be great to have an override (similar to "drawGizmos" of the SceneView) to control the outline.