Question by
long88730 · Sep 01, 2017 at 03:28 AM ·
unity5unityeditor
A strange issue by custom editor about keycode event.
I make a custom editor for my own script, but a strange issue in OnSceneGUI() Func, that was sometimes i can get the keydown and keyup event, sometimes not.(i realy focused on the sceneview and selected my script gameobject on hierarchy), i didn't modify any code in this func, but it real occurrence, my codes is below, it's reallllllllllly simple, so i ask for help here, does anyone know this?
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(HexGrid))]
public class HexGridEditor : Editor
{
void OnSceneGUI()
{
var hex = target as HexGrid;
var cur = Event.current;
Debug.Log(cur.type); // sometimes has keydown and keyup event, some times not
}
}
Comment