Rune580 / LethalCompanyInputUtils

GNU Lesser General Public License v3.0
12 stars 5 forks source link

Overriding normal behaviour for key #12

Closed BenMcAvoy closed 8 months ago

BenMcAvoy commented 8 months ago

Imagine I am binding to <Keyboard/p>. I would like to disable the in-game behaviour of it when a boolean is true. So say for example, if the middle mouse button or control is held down whilst p is pressed, it won't type p in the terminal or whatever other typical behaviour and would instead just run a piece of code.

Is this possible? Thanks for your time.

Rune580 commented 8 months ago

you can enable and disable your input actions as needed, this is part of unity's input system.

say you have an InputAction like so InputAction CustomKey you would just do CustomKey.Disable() or CustomKey.Enable()

BenMcAvoy commented 8 months ago

That sounds great. So sorry for the late response, only just got the email (notification). How would I also make it so that the game does not for example type it in the terminal

Rune580 commented 8 months ago

well I'd probably hook into whatever function runs when you enter the terminal, and have it enable and disable your InputActions

Rune580 commented 8 months ago

unless you object, I'm probably going to close this issue