//Get the input field.
var inputField = GameObject.Find("Input Filed Name");
// Get the text
var child = inputField.transform.Find("Text");
var text = child.GetComponent<Text>().text;
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
// Spacebar was pressed
}
if (Input.GetMouseButtonDown(0))
{
// Left mouse was pressed
}
}
private void OnEnable()
{
playerInput = GetComponent<PlayerInput>();
playerInput.actions["Action"].performed += HandleAction
}
private void Update() {
value = playerInput.actions["Value"].ReadValue<Vector2>();
}
private void HandleAction(InputAction.CallbackContext context)
{
HandleJump();
}