Input with Low Framerate

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);
            }
        }

I’ve added a counter for the down and up. On Windows the values match up at 30fps, on linux I get a strong increase in Up vs Down. I will have to do further tests with different code, but I am a bit astonished that I get different results on different platforms. Should I report this, or am I just going about it wrong?

Unity has a new input system that is event based. You might be more comfortable with using it. The instructions for using it in your project are near the bottom of this post: Unity Blog

Thanks!!

Just for sake of delivering a result, I had to find out if my observation was correct. It looks like it was.

if (Input.GetMouseButtonUp(i))
            {
                upCount[i]++;
            }
            if (Input.GetMouseButtonDown(i))
            {
                downCount[i]++;
            }

Using the code above, I can see that up and down do not deliver the same results and there is no obvious reason why. While testing the up and down count even switched front runner places. So yeah, not reliable on Linux (ubuntu). Real shame as I will have to rework my entire input code with the new system that will hopefully be more stable.