CS0426: не удалось найти тип или имя пространства имен «InputAction».C#

Место общения программистов C#
Ответить
Anonymous
 CS0426: не удалось найти тип или имя пространства имен «InputAction».

Сообщение Anonymous »

Я пытаюсь создать 3D-игру, и все, что я пытаюсь сделать, это заставить моего персонажа ходить, но я продолжаю получать сообщение «Assets/AnimationAndMovementController.cs(26,28): ошибка CS0246: не удалось найти тип или имя пространства имен 'InputAction' (вам не хватает директивы using или ссылки на сборку?)»...
Я не совсем уверен, что делать.
Я очень новичок в Unity и C# Sharp, так что, может быть, я не вижу никакого смысла?
ну, вот код...

Код: Выделить всё

using System.Collections;
using System.Collections.Generic;
using static System.Numerics.Vector3;
using UnityEngine;

public class AnimationAndMovementController : MonoBehaviour
{
PlayerInput playerInput;
CharacterController characterController;

Vector2 currentMovementInput;
Vector3 currentMovement;
bool isMovementPressed;

void Awake()
{
playerInput = new PlayerInput();
characterController = GetComponent();

playerInput.CharacterControls.Move.started += onMovementInput;
playerInput.CharacterControls.Move.canceled += onMovementInput;
playerInput.CharacterControls.Move.performed += onMovementInput;
}

void onMovementInput (InputAction.CallbackContext context)
{
currentMovementInput = context.ReadValue();
currentMovement.x = currentMovementInput.x;
currentMovement.z = currentMovementInput.y;
isMovementPressed = currentMovementInput.x != 0 || currentMovementInput.y != 0;
}

// Update is called once per frame
void Update()
{
characterController.Move(currentMovement * Time.deltaTime);
}

void OnEnable()
{
playerInput.CharacterControls.Enable();
}

void OnDisable()
{
playerInput.CharacterControls.Disable();
}
}
Я очень ценю помощь!

Подробнее здесь: https://stackoverflow.com/questions/734 ... t-be-found
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»