When I test my game on Linux (ubuntu), I have a framerate of about 30/32. It seems like some of the Input events are not registering. I’m using Input.GetMouseButtonUp(x) and Input.GetMouseButtonDown(x). What happens if the mouse is down and up within the same frame? Does only mouse button up fire or do both fire? It works fine on windows when I set application framerate to 30.
I’m used to having an event system, so the input handling in unity is a bit weird. I’ve discovered the IPointerDownHandler interface, but I need to attach to the whole screen not a gameobject. Is there a global equivalent?
//update all downPositions to show they are not fresh
for (var i = 0; i < 2; i++)
{
var id = -i - 1;
if (Input.GetMouseButtonUp(i))
{
downPositions.Remove(id);
clearGuesture(id);
}
else if (Input.GetMouseButtonDown(i))
{
var di = getDownPosition(Input.mousePosition, id);
addEcho(id, di);
}
else if (downPositions.ContainsKey(id))
{
downPositions[id] = updateDownPosition(downPositions[id], Input.mousePosition);
}
}