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?
-
\$\begingroup\$ Do you mean in the game view? The scene view should be selectable by default. \$\endgroup\$– StephanDec 7, 2017 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\$– iGetItDec 8, 2017 at 3:23
1 Answer
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.
Clicking on it will select the relevant object:
-
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, 2017 at 13:05