I have some UI-buttons which I want by a cutscene blocked from Input.
I use the code:
using UnityEngine.InputSystem;
private PlayerInput input = null;
private bool buttonsDone = false;
private void Awake()
{
input = gameObject.AddComponent<PlayerInput>();
buttonsDone = false;
}
void Update()
{
if(!buttonsDone)
{
input.DeactivateInput();
input.enabled = false;
Debug.Log("DeactivateInput()");
buttonsDone = true;
}
}
But this doesn’t work. The arrow-keys on keyboard and gamepad are deactivated but if I press a joystick-button or “Enter” on the keyboard the input is still recognized and triggers the selected button. Same with the mouse, the clicking on the button triggers too and the button is highlighted if the mouse pointer is over the button.