Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click and hold doesn't work #29

Open
BitBarrel opened this issue Apr 3, 2024 · 3 comments
Open

Click and hold doesn't work #29

BitBarrel opened this issue Apr 3, 2024 · 3 comments

Comments

@BitBarrel
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Author

BitBarrel commented Aug 18, 2024

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)

Edit:
For the new input system it should be:
Mouse.current.leftButton.isPressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants