New Input System Not Working

I decided to convert my game to use the new Input Manager, however, even after following multiple tutorials, nothing works. I even created a test function using the buttonSouth, but that didn’t work.

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

public class PlayerMove : MonoBehaviour
{
PlayerController controls;
public float speed = 7;
public float lerpSpeed = 5;
Vector2 move;

private void Awake()
{
controls = new PlayerController();
controls.Gameplay.Test.performed += ctv => Test();
controls.Gameplay.Move.performed += ctx => move = ctx.ReadValue();
controls.Gameplay.Move.canceled += ctc => move = Vector2.zero;
}

void Update()
{
Vector2 m = new Vector2(-move.x,move.y) * Time.deltaTime;
transform.Translate(m, Space.World);
}

void Test()
{
print(“Hi”);
}

}

You need to .Enable() the generated C# action map via code.

1 Like

yeah, I added that. It still doesn’t work. Even with the test function.

Well, you will need to debug what’s wrong. We don’t know anything about your setup. So start here:
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.8/manual/Debugging.html

The code you posted won’t even compile on its own, I don’t think. PlayerController is not one of Unity’s classes. If it’s your own, then we have no idea what it does. Also, we don’t know if you’re using the Player Input Manager component in the scene and wiring up to your methods, if you’re using Unity Events, etc…

Can you elaborate on this? I have been working on a game and just got some UI built and it seems the event system isn’t even picking up any UI elements.

That doesn’t seem related to my post/the original post. Mine was about, if you’re using a generated C# Input Actions object, you need to call .Enable() on it after creating it.

For UI elements you need to ensure there is a standalone input module when using the new Input system: https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-StandaloneInputModule.html

For the Move, try instead of getting the value from performed, get it from Update like this:

    void Update()
    {
        move = controls.Gameplay.Move.ReadValue<Vector2>();
    }

https://docs.unity3d.com/Packages/com.unity.inputsystem@1.7/manual/Workflow-ActionsAsset.html?q=readvalue<vector2#referencing-the-actions-asset-in-the-inspector

For the Button South it’s difficult to know the issue, maybe show the screenshot of your PlayerController scheme to show how you set it.

In the Input System Packages, Unity provide the sample for the basic Input Actions, maybe it can be a good reference.