GetComponent() имеет значение Null.
Код: Выделить всё
using System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Certains.Cientifics.Notes
{
public class InputController : MonoBehaviour
{
private PlayerInput controls;
private IMovable _move;
private void Awake()
{
controls = new PlayerInput();
_move = GetComponent();
}
private void OnEnable() => controls.Enable();
private void OnDisable() => controls.Disable();
private void OnDestroy() => controls.Disable();
private void Update()
{
ReadMove();
}
private void ReadMove()
{
_move?.Move(controls.Player.Move.ReadValue());
Debug.Log(_move);`This problem`
}
}
}
using UnityEngine;
namespace Certains.Cientifics.Notes
{
public interface IMovable
{
void Move(Vector2 direction);
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... -interface