Jump to content
 
jboss

Touchpad click registered multiple times in FixedUpdate

Recommended Posts

I am using the touchpad to change parameters, but only when I click the pad, I am using this in two scenes and noticed that in one of them the click was detected twice or even three times. The difference was that in the scene where it was registred multiple times I had the code i FixedUpdate, while in the other scene I had the code in Update. When I moved the code from FixedUpdate to Update it worked fine also in the second scene.

Here's the code I am using:

        if (ViveInput.GetPressDown(triggerHandRole, ControllerButton.Pad))

where triggerHandRole indicates if the user is lefthanded or righthanded.

When I added debug info, I saw that the click was registered at time x and then at time x+deltaTime, so for two frames after eachother. It was not detected after that until I removed my finger from the pad and clicked it again.

For my scene it's no problem to move the code to Update, but I think it is somethig to investigate.

Share this post


Link to post
Share on other sites

@jboss Does it happen everytime when you pressed on the Pad?

I tested on my side, it seems only a couple of times(not very easily to reproduce, probably 1 out 10 or less) it will false trigger twice in a row.

And, I found out that there is thread for people complaining that FixedUpdate will execute twice.

Either you can use a flag to avoid this to happen or use Update instead.

Share this post


Link to post
Share on other sites

Thanks for the link. That explains it well. I had never experienced this before, so I associated it with the Vive Input Utility, but I see now that it is a Unity issue.

In my case it is pretty much every time I press the pad, sometimes it regsters once, sometimes 3 times, but mostly 2. But I have a fairly old laptop, so it may need to 'catch up' on frames frequently.

@chengnay

Share this post


Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...