#Mouse clicks not registering
1 messages · Page 1 of 1 (latest)
are you sure its not working? i think whats happening is, clicked becomes true for a single frame (when the button is pressed down) and then gets set to false the frame right after
Oh, I see. You already seem to have gotten the advice to not get input in FixedUpdate.
What you fail to consider here though, is that you are still syncing the input state every frame - which essentially results in the same as checking input in FixedUpdate.
The (general) solution is (or would be) to only set clicked to true in Update, and then reset it in FixedUpdate.
I disagree
The whole FixedUpdate loop here is completely pointless
The only thing remotely physics related here is the call to AddForce, and that's not even a continuous thing it's a one-shot (especially considering you're just doing it once, if mouse is pressed)
Seems like a separate issue, but yes.
You really don't need FixedUpdate here at all tho
do take into account what yasa said though
he is right
AddForce isn't continuous
FixedUpdate is for continuous physics operations
You're just simply applying a force if and only if the mouse is pressed, and for a single frame only
It's irrelevant what you use, it's one-shot
You could AddForce in Start, it doesn't matter. It's not a continuos thing
Yesn't.
Depending on the ForceMode (the default of which is ForceMode.Force afaik), it can be meant for continuous use, though.
No. Just pointing out that it can be. 😄
