Title, basically. Down to the final bug but it's an annoying one. It's working perfectly fine for mouse clicks, only firing a single time per click. Controller selection, single fire too. Touch screen tap though it's consistently firing 3 times in rapid succession with a single tap. I tried to use OnPointerDown but that doesn't fire at all for mouse or touch, googling says you can only really do that once in the project or something idk?? But I can't refactor the entire project to use that function here.
This is the only script that uses OnClick though, everywhere else touch only registers once as it should
#OnClick working for mouse, but fires 3 times for touchscreen tap
1 messages · Page 1 of 1 (latest)
what OnClick are you using here?
also OnPointerDown needs a raycaster and an interface to be implemented, so if you didn't have those, that'd be the issue
googling says you can only really do that once in the project or something idk
not sure where you're getting that. that's definitely not true
Forums, people discussing pointerdown not working and there's a lot of selected solutions saying if you use those functions higher up in the hierarchy then that eats the input
Uhhh, great question
that'd probably be for stuff overlapping
that doesn't mean you can't have 2 pointer handlers in the same scene
Pointer down did have a raycast an all tho. I copied stuff over from another script
Debug log at the very start of the function just never fires
the object with the pointer handler had a raycast?
Yeah
yeah that's not correct
you need a raycaster on the camera, iirc? might be the canvas for a graphic raycaster
and also a corresponding target on the, well, target
The raycasting code is already in onclick and works perfectly for clicking idk what you mean. It's raycasting from the position of the pointer to the target
i'm not talking about Physics.Raycast
a raycaster is a component that's required for the pointer handlers
Idk man all I know is pointer down is working literally in the rest of the game, even on the same screen I'm trying to get this to work
you just tried onpointerdown for this, but it's working in the rest of the game? i'm confused
you really aren't giving much info to work with here
Yeah. That's what's so confusing
no, i'm confused what the scenario you're in is, because that's self-conflicting
you still have not said what OnClick is from
Just clicking in the scene. Nothing is directly calling OnClick
is it from a playerinput or something? there's no OnClick built-in message either
what do you expect to be calling it
show your code; we have no idea what you're currently doing
When the user clicks or taps, which is what it does - but tapping causes it to fire 3 times. I guess I should look at the input action then - NGL thought it was a built in action
I cannot unfortunately
Hm, the binding is set to touch*/press in the input action
Changing it to press single input still fires 3 times 🤔 twice when pressing, once when releasing
There is nothing calling the function at all. It's just the input action
just say it's the input action