Can't get input manager to show up

So, I’m stuck on the part where we put in the input manager into the Player State Machine in the inspector. I’ve followed everything step by step, but instead of getting a new window in the inspector I get the following error: Assets\Scripts\InputReader.cs(7,43): error CS0535: ‘InputReader’ does not implement interface member ‘Controls.IPlayerActions.OnDodge(InputAction.CallbackContext)’

Here’s the block of code in question.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class InputReader : MonoBehaviour, Controls.IPlayerActions
{
    public event Action JumpEvent;
    public event Action DodgeEvent;

    private Controls controls;

    void Start()
    {
        controls = new Controls();
        controls.Player.SetCallbacks(this);

        controls.Player.Enable();
    }

    private void OnDestroy()
    {
        controls.Player.Disable();
    }

    public void OnJump(InputAction.CallbackContext context)
    {
        if (!context.performed)
        {
            return;
        }
        
        JumpEvent?.Invoke();
    }

    public void OnDodge(InputAction.CallbackContext context)
    {
        if (!context.performed)
        {
            return;
        }

        DodgeEvent?.Invoke();
    }
}

Can you post your PlayerStateMachine.cs please

Yep! Here ya go.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerStateMachine : StateMachine
{
    [field: SerializeField] public InputReader InputReader { get; private set; }

    void Start()
    {
        SwitchState(new PlayerTestState(this));
    }

}

Hey @Urist_McDev . I think you are missing at the top " using UnityEngine.InputSystem; " . If that’s not the case can you double-check if you have setup the Dodge Inputs in the Controls file and if you don’t have a Red line with a red light bulb on the side to implement the missing members ?

Like this


Putting using UnityEngine.InputSystem; at the top fixed it, thanks!

1 Like

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

Privacy & Terms