IsInputKeyDown issue

Hello,

I have a function which runs each tick. I’m trying to change a bool to true when player clicks left mouse.

I have the code shown, but it wont fire true.

Oddly, when I click just outside the preview window it sometimes seems to work. This makes me think its not blueprint problem but something to do with the clickable area of my game. I’m so confused.

2D game. This is on my player character and is called each tick.
I’m using it to determine if the player has pressed the mouse button.
However sometimes it doesn’t seem to work at all.

Why are you doing this? Where does this function reside?

Hello ,

I want to advose you not calling it every tick but instead using a Event, I have done simmilair stuff, What I did is:

I went to project settings by the edit in the top left corner in UE4. I addded a Evnet that triggers on clicking left mouse button.
Then in my blueprint I called this event and used a boolean that I set to true on the pressed event and to false on the release event, now you can go ahead in your tick event with this bool, or don’t use the bool and add your code after the pressed event, it maybe worth to create a new event after that but that depends on your setup.

Yep… don’t do that. Do what suggested below instead.