void OnGUI()
{
doubleTapTimer += Time.deltaTime;
numDown = 0;
int num;
if (Event.current.type == EventType.KeyDown) {
// Convert to numeric value for convenience :)
num = Event.current.keyCode - KeyCode.Alpha1 + 1;
// Avoid having multiple number keys pressed!
if (numDown == 0 && num >= 1 && num <= 9) {
numDown = num;
doubleTapped = false;
doubleTapTimer = 0;
Event.current.Use();
}
if (numDown > 0)
{
// If prevNumDown == num then it's been double tapped.
if (numDown == prevNumDown && doubleTapTimer < 1)
doubleTapped = true;
if (doubleTapped)
numDown += 10;
if (doubleTapTimer > 1)
prevNumDown = -1;
prevNumDown = numDown;
}
}
}
That is the code that runs in Editor mode but not a Post Built / .EXE version of my game. Any idea why?
It seems to be the Event is not being checked / called? I can’t tell. I do know OnGUI is being called as I put a box with some text in there to check.