Select GameObjects OnSceneView without Colliders
I'm using onSceneGUIDelegate to do very specific things on the scene view:
- first one will be to instantiate gameObjects with 1 click 
- Second one is to delete gameObjects with key + click 
First one it's done, easy.
However to achieve the second one I need to know whats under my mouse when I click without the gameObjects having colliders. It's very important that I can select them without colliders given that not all of them will have them but, they do need to have at-least one renderer of any kind.
Of course I know where my mouse is on world space, that's no problem.
Any ideas? I might be approaching this from the wrong perspective, if so, let me know which way you would approach it.
I found the answer for anyone looking for the same thing
GameObject go = HandleUtility.PickGameObject(Event.current.mousePosition, false);
This will do the trick, cheers!
Answer by Limbo · Jun 06, 2017 at 06:38 PM
If anyone's interested I figured this a while back, all you need to do is call
 void OnSceneGUI(SceneView view)
 {
     Event e = Event.current;
     GameObject go = HandleUtility.PickGameObject(e.mousePosition, true);
     // Do what you must with the go selected
     Debug.Log(go);
 }
The second parameter will select the prefab root if set to true, here the link to the doc:
https://docs.unity3d.com/ScriptReference/HandleUtility.PickGameObject.html
wow, didn't know they have such a convenient function ! thanks!
Your answer
 
 
             Follow this Question
Related Questions
Handles.ScaleHandle gizmo gui does not move? 0 Answers
Do Unity Editor GUI Utilities (Handles.DrawLine & EditorGUI.DrawRect) have limitations? 2 Answers
Manually unselect a handle in the editor from a script 0 Answers
UnityEvent with all derived types in listeners serialized in Inspector 0 Answers
How do I execute code while dragging an ArcHandle? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                