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.
  2. Dismiss Notice

Disable Selection Frame in Scene window

Discussion in 'Scripting' started by Leslie-Young, Jun 29, 2012.

  1. Leslie-Young

    Leslie-Young

    Joined:
    Dec 24, 2008
    Posts:
    1,146
    How do I disable the selection frame (the blue frame that comes up when you left-click drag) in the scene window?

    [edit] and while asking about editor stuff, is there a way to hide the move/scale/rotate gizmo for an object?

    [edit] if anyone else interrested in this topic, have a look at these
    Tools.current = Tool.View; // to force the view mode (exit the move/rotate/scale tools)
    and
    Event.current.Use(); / /which can be used to prevent the mouse drag from moving/rotating the scene view when in the view tool/mode. Just be sure to use it at the correcttime, like when u did actually use/consume the event (like a mouse click-drag event).
     
    Last edited: Jul 11, 2012
  2. cj-currie

    cj-currie

    Joined:
    Nov 27, 2008
    Posts:
    301
    Bump! This would be great to know.
     
  3. Barsonax

    Barsonax

    Joined:
    Sep 10, 2015
    Posts:
    5
    Iam looking for a solution to this too
     
  4. FinXzuOP

    FinXzuOP

    Joined:
    Nov 30, 2021
    Posts:
    2
    Eventhough it is a very old thread, maybe someone will have the same question. I solved that issue by using EditorGUIUtility.hotControl

    Just set up something like that in the OnSceneGUI():

    if (currentEvent.type == EventType.MouseDown && currentEvent.button == 0 && objectSelected == true) { EditorGUIUtility.hotControl = 1; }

    objectSelected is just an additional condition I have used, you can put your own condition there if you want any.
    Be aware that you might not be able to select new objects using this. I used it for a tool to edit objects and did bind object deselction on a key.
     
    Magnilum likes this.
  5. Magnilum

    Magnilum

    Joined:
    Jul 1, 2019
    Posts:
    154
    It seems there is a drawback which prevent you to move editor windows of the game as we want. But it is a good solution for now, thank you !!!