rive-app / rive-unity

MIT License
87 stars 8 forks source link

Click and hold doesn't work #29

Open BitBarrel opened 5 months ago

BitBarrel commented 5 months ago

I have a button that does not allow click and hold. Unity releases the button as soon as it is pressed down. This is a problem in many platforms. It also doesn't work with React Native. It didn't used to work with Web JS either but it was fixed in the latest version of Web JS.

To reproduce:

Load the included riv file into Unity. The rev is provided too. nested_bug.zip

Click and keep mouse down on the Next button. You will see that it immediately releases the button.

Now try the same in Web JS (latest version):

https://codesandbox.io/p/sandbox/rive-quick-start-js-forked-5k2xzc

Here you will see that click and hold works.

damzobridge commented 3 months ago

Thanks for sending over the sample .riv and demos. I tested it out on the latest unity version >v0.1.170 and it seems to work as expected, based on the webJS example you provided.

If you're able to, try upgrading to the new version to see if things are working on your end.

BitBarrel commented 3 months ago

If you're able to, try upgrading to the new version to see if things are working on your end.

Unfortunately, it still doesn't work in Unity (it works with WebJS).

Tested with Rive version .172 and Unity 2023.1,17.f1

Here is a repo (Unity scene is called "test").

basic.zip

BitBarrel commented 4 weeks ago

I found the issue. In RiveScreen.cs the following function is used to detect mouse down: Input.GetMouseButtonDown(0)

However, that function does not support click and hold.

This supports click and hold: Input.GetMouseButton(0)