- Home /
How do I check clicking and dragging in the Editor?
I have an editor script where I need to check if the developer clicks in one area, and then holds it until it reaches another area. I tried to make something like this with the Unity Handles, but it does not activate Handle buttons when the mouse is held down.
function OnSceneGUI(){
if(Handles.Button(somePosition,someDirection,
size,pickSize, Handles.DrawRectangle)){
//action when handle is clicked
}
}
I'm trying to get something like this:
if mouse down:
if handle1 touched:
nextHandle = 1;
if handle2 touched:
nextHandle = 2;
if handle3 touched:
nextHandle = 3;
if(lastHandle != nextHandle):
SomeFunction(lastHandle, nextHandle);
lastHandle = nextHandle;
else:
nextHandle = -1;
lastHandle = -2;
When the player holds down the mouse and drags from handle1 to handle2, for example, the script would be able to pick that up.
Comment