- Home /
Multi selection of grid values in a custom Editor Window.
I have two grids in a custom editor window. I'm trying to find the best way to detect 2 values for when the mouse is clicked down, and when it's released. For example, I click on 0,0 and release on 1,0.
I'm using something similar to this in OnGUI();
Event e = Event.current;
EventType et = e.type;
mousePos = e.mousePosition;
switch (et)
{
case EventType.MouseDown :
startVector = grid1.GetValue(mousePos)
break;
case EventType.MouseUp :
endVector = grid1.GetValue(mousePos)
break;
}
Answer by Optimus_L · Jan 24, 2021 at 07:43 AM
Silly me... Just needed to store a Vector2 for the grid position on EventType.MouseDown, and then store a second Vector2 for EventType.MouseUp.
Your answer
![](https://koobas.hobune.stream/wayback/20220613023904im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Get UnityEvent reference from SerializedProperty 1 Answer
UnityEvent Serialization Problem 1 Answer
Unity Editor Scripts: GameObject Added / Removed Event? 1 Answer
Non-monobehavior editor script subscribing to delegate event and persisting on application reload 0 Answers
Event.current.Use() not consuming event in editor SceneView 1 Answer