I have a player object with Player Input and my Character Input components on them. My character input is doing super-simple things, but I can’t get the OnMove to fire for the given action. The Debug.Log never appears when I try to execute the action.
What am I doing wrong here? I thought I’d followed the docs.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
[RequireComponent(typeof(Rigidbody2D))]
public class CharacterInput : MonoBehaviour
{
[SerializeField] private float speed;
private Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
}
public void OnMove(InputValue input)
{
Debug.Log("aha");
Vector2 inputVec = input.Get<Vector2>();
HandleMove(inputVec);
}
private void HandleMove(Vector2 fromInupt)
{
transform.position += new Vector3(fromInupt.x * speed * Time.deltaTime, 0, fromInupt.y * speed * Time.deltaTime);
}
}