Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Input System Controls UI

Discussion in 'Input System' started by Masternd887YT, Aug 2, 2020.

  1. Masternd887YT

    Masternd887YT

    Joined:
    Feb 15, 2020
    Posts:
    2
    So I'm trying to make a UI, and am trying to set it so a button will pop up a screen and it will use PerformInteractiveRebinding to get the input and change a button to say the value. The problem is that the screen will show up, but when I press and input, it won't be registered by the input system and the screen will not go away. I am new to Unity, so my code probably has a ton of things wrong. Thanks!
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5. using UnityEngine.InputSystem;
    6. public class Controls : MonoBehaviour
    7. {
    8.     public GameObject InputPanel;
    9.     public InputActionReference m_actionReference;
    10.     private InputAction m_action;
    11.     // Start is called before the first frame update
    12.     void Start()
    13.     {
    14.         m_action = m_actionReference.action;
    15.     }
    16.  
    17.     // Update is called once per frame
    18.     void Update()
    19.     {
    20.        
    21.  
    22.     }
    23.     public void CallChangeControls(){
    24.         ChangeControls(m_actionReference);
    25.     }
    26.  
    27.     public void ChangeControls(InputAction player) {
    28.         InputPanel.SetActive(true);
    29.         var rebind = player.PerformInteractiveRebinding()
    30.         .WithControlsExcluding("Mouse").OnComplete(operation => CCC());
    31.     }
    32.     public void CCC(){
    33.        InputPanel.SetActive(false);
    34.     }
     
  2. Masternd887YT

    Masternd887YT

    Joined:
    Feb 15, 2020
    Posts:
    2
unityunity