How to disable inputs for game while in pause menu?

Hi,

I’ve made a pause menu using OnGui. The problem I’m having is that when I pause I can still trigger some actions in the game when pressing the buttons on the pause menu. How should I approach this? I was thinking of disabling the inputs but how do I disable the inputs only for the game and not for the pause menu?

For the in-game triggers, I’m using an invisible plane with hit.collider.

Hope someone can help. Thanks in advance.

-Hakimo

have a global manager that knows if you paused or not and all input scripts as that one for pause and stop handling the input.
or register all control scripts with that manager and let it handle start / stop pause and on start of pause, all registered control script are just put on sleep with .enabled = false

Hi Dreamora,

Thanks for the reply. I wasn’t sure how to do your method but it’s probably because my inputs in the game are basically hit colliders on planes.

So what I did was just disable the game object and enable when needed using the “GameObject.active = false”.

Thanks again.
-Hakimo

1 Like

thats a way too.

I would have put it up one level: You always do input through mouse / keyboard
that input is processed somewhere to result in movement or raycasts.

thats the place where I would have skipped doing that processing, if the game is considered to be in pause mode