A new expression requires an argument list or (), [], or {} after type

My code is:

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

public class InputManager : MonoBehaviour
{
    private PlayerInput playerInput;
    private playerInput.OnFootActions onFoot;

    private PlayerMotor motor;

    void Awake()
    {
        playerInput = new.PlayerInput();
        onFoot = playerInput.OnFoot();
        motor = GetComponenet<PlayerMotor>();
    }

    void FixedUpdate()
    {
        //tell playermotor to move using value form the movement action.
        motor.ProcessMove(onFoot.Movement.ReadValue<Vector2>());
    }
    private void OnEnable()
    {
        onFoot.Enable();
    }
    private void OnDisable()
    {
        onFoot.Disable();
    }
}

And I don’t know why nothing is working.

  • It’s new PlayerInput() and not new.PlayerInput()

  • Also, OnEnable is called before Awake if I’m not mistaken

using UnityEngine;
using UnityEngine.InputSystem;

[RequireComponent( typeof(PlayerMotor) )]
public class InputManager : MonoBehaviour
{
    private PlayerInput playerInput;
    private playerInput.OnFootActions onFoot;

    private PlayerMotor motor;

    void Awake()
    {
        playerInput = new PlayerInput();
        {
            onFoot = playerInput.OnFoot();
            onFoot.Enable();
        }
        
        motor = GetComponenet<PlayerMotor>();
    }

    void OnDestroy ()
	{
		playerInput.Dispose();
	}

    void FixedUpdate()
    {
        //tell playermotor to move using value form the movement action.
        motor.ProcessMove(onFoot.Movement.ReadValue<Vector2>());
    }

}

Sorry, but I have fixed the error and forgot about the post. if I had done new.PlayerInput() I would have gotten another error, btw. I’m still thankful that you tried to help.