When I add controls = new Controls(); i get the error:
The call is ambiguous between the following methods or properties: ‘Controls.Controls()’ and ‘Controls.Controls()’
Tried copy/pasting the code from the resources:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using static Controls;
[CreateAssetMenu(fileName = "New Input Reader", menuName = "Input/Input Reader")]
public class InputReader : ScriptableObject, IPlayerActions
{
public event Action<Vector2> MoveEvent;
public event Action<bool> PrimaryFireEvent;
private Controls controls;
private void OnEnable()
{
if (controls == null)
{
controls = new Controls();
controls.Player.SetCallbacks(this);
}
controls.Player.Enable();
}
public void OnMove(InputAction.CallbackContext context)
{
MoveEvent?.Invoke(context.ReadValue<Vector2>());
}
public void OnPrimaryFire(InputAction.CallbackContext context)
{
if (context.performed)
{
PrimaryFireEvent?.Invoke(true);
}
else if (context.canceled)
{
PrimaryFireEvent?.Invoke(false);
}
}
}