Hi guys, there is something wrong happening with my Editor Window, check the code:
using UnityEngine;
using UnityEditor;
using System.Collections;
public class NewMouseTest : EditorWindow
{
[MenuItem ("Window/My Window2")]
static void Init ()
{
NewMouseTest window = EditorWindow.GetWindow (typeof (NewMouseTest)) as NewMouseTest;
}
void OnGUI ()
{
Event e = Event.current;
Debug.Log(e.button);
wantsMouseMove = true;
}
}
Turns out the Left Mouse Button(0) is being logged aways, no matter what, and with this I can’t check for clicks inside my windows, whats wrong with the script?
Screenshot of the logs:
http://d.pr/i/qvGO
Edit 1:
This piece of code will give the same result, aways true.
int counter = 0;
void OnGUI ()
{
Event e = Event.current;
if(e.isMouse && e.button == 0)
{
counter++;
}
GUILayout.Label(counter.ToString());
wantsMouseMove = true;
}