Complete Unity C# Lecture 76 - Action not printing to console

Here’s my code:

using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void onMove(InputValue value) 
    {
        Debug.Log(value.Get<Vector2>());
    }
}

Hi Andrew,

C# is case-sensitive. If an Action method does not work, the first thing to do is to check the spelling because that’s the most common mistake. The correct spelling is defined in the PlayerInput component.

I hope this helped. :slight_smile:


See also:

1 Like

@Nina is right. Also, the messages being called has the same name as the input action, but starts with On. In your case the action is called Movement, so the message will be OnMovement. If you look at the inspector, there’s actually a little hint showing you what the messages will be that is being called
image


Edit Just realised this is exactly what Nina said… my bad

Thank you, that’s exactly what the issue was!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms