Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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

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

  1. EidLoi


    Nov 20, 2019

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


    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.