- Home /
Disable ALL user input
Hi! I was wondering if it's possible to disable ALL (as in ALL) user input (keyboard, mouse, etc.) and then re-enable them all again.
What I'm trying to do:
I have an opening cutscene that's playing realtime and I want to disable interaction with the game while the cutscene is live. I've tried just setting GameObject.active = false;
but this makes the objects invisible.
Thanks! :D
By the way, I've searched on this question but didn't find anything. So if it's there elsewhere, sorry, I fail at searching. Please be a lamb and kindly point me there. :P
Are you trying to disable things called in OnGUI.. or GUIText/GUITexture? Not sure what these "Objects" are that you are referring to.
have a boolean that turns true, when it is true, discard all input processing
@hijinxbassist I'm trying to disable clicks to a Toolkit 2D tk2dButton.
@brain56 Yeah, deactivating the object/script would get rid of all the rendering. Im not sure how they handle clicks, you will have to modify the code, contact the devs, or hang out here til someone who has the kit answers. Id suggest modifying you question to include that you are using that kit, otherwise other users think you are using your own Unity code.
Answer by tomka · May 29, 2012 at 06:34 AM
Create a wrapper around the Input class, and then call your input class rather than UnityEngine.Input. That way you can create a flag that will make your input class act as though no input has occurred.
Answer by ABD_ALRAHMAN_SAMMANI · Jul 25, 2016 at 04:15 PM
disable the script that make the player move public void Toogle_Input(bool IsAlive) { _user_Input.enabled = IsAlive; }