0
\$\begingroup\$

I have several game objects with colliders in my game. I have enabled Always Show Colliders to keep all of them visible in my scene view. Because the objects are a lot, selecting them from the hierarchy window is a bit cumbersome and really slowing down my workflow. How can I select an object by left mouse clicking on it in the scene view of an editor?

\$\endgroup\$
  • \$\begingroup\$ Do you mean in the game view? The scene view should be selectable by default. \$\endgroup\$ – Stephan Dec 7 '17 at 21:37
  • \$\begingroup\$ @Stephan No, if I understand your question well. I just want to be able to select game objects using the left mouse click in scene view when the game is not running. \$\endgroup\$ – iGetIt Dec 8 '17 at 3:23
1
\$\begingroup\$

If you want to be able to select colliders without adding any sort of mesh to them, then you can call an icon draw OnDrawGizmos() on a script and just add it to whatever you want to be drawn:

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class DrawIcon : MonoBehaviour {
    void OnDrawGizmos()
    {
        Gizmos.DrawIcon(transform.position, "Collider Gizmo.tiff", true);
    }
}

You can also then select a shape / color combo from the gizmos menu for DrawIcon in this case.

enter image description here

Clicking on it will select the relevant object:

enter image description here Experiment with the code to customize it.

\$\endgroup\$
  • 1
    \$\begingroup\$ You can also set this up via the object's inspector if you don't want to add an extra script to each object. \$\endgroup\$ – DMGregory Dec 8 '17 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.