Working out which object the mouse is over in the editor
Hi there, I am trying to make a custom level editor that runs in the editor window, not in play mode. I would like to know how I can tell which object in my scene the mouse is over. In play mode, I have a script called "Hover" that has on MouseOver()*functions. void OnMouseOver() {
anim.Play("GridSquareSelected"); }
void OnMouseExit()
{
anim.Play("GridSquareNotSelected");
}
Works great, highlighting the grid cells with colour, but it only works in play mode, even with the script set as [ExecuteInEditMode]. I'm fairly new to editor scripting so I was wondering if there was a way to get that similar functionality of a MouseOver in the Editor window itself?
I tried Googling but all of the references were dated and no longer seem to work. They all talk about SceneView but if that method still works, the implementation has changed and I can't find documenation on it. They were dated back around 2013. I thought maybe OnSceneGUI might be a place to start, but it seems to be about drawing, not getting object information and interacting with objects. So to recap, I want to know which object my mouse is over in the Editor window, outside of Play Mode, to make a custom level editor.
Thanks for your time.
Your answer
Follow this Question
Related Questions
How to change Texture in editor 0 Answers
Any way to set AnimatorOverrideController's animation clips programatically? 1 Answer
How to get mouse click world position in the scene view in editor script? 3 Answers
Error loading auto-generated monobehavior at run-time 0 Answers
in-game code editor 1 Answer