Falta una directiva de uso o una referencia de ensamblaje

programación


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;
    private PlayerLook look;
    // Start is called before the first frame update
    void Awake()
    {
        playerInput = new PlayerInput();
        onFoot = playerInput.OnFoot;

        motor = GetComponent<PlayerMotor>();
        look = GetComponent<PlayerLook>();

        onFoot.Jump.performed += ctx => motor.Jump();
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        // tell the playermotor to move using the value from the action
        motor.ProcessMove(onFoot.Movement.ReadValue<Vector2>());
    }
    private void LateUpdate()
    {
        look.ProcessLook(onFoot.look.ReadValue<Vector2>());
    }
    private void OnEnable()
    {
        onFoot.Enable();
    }
    private void OnDisable()
    {
        onFoot.Disable();
    }
}

Lo que he probado:

look.ProcessLook(onFoot.look.ReadValue<vector2>());


WHATS IN BOLD IS THE ERROR

Solución 1

El compilador está buscando algo llamado buscar en el tipo OnFootAction. Si ha seguido el tutorial con precisión, la sintaxis correcta no es onFoot.look.ReadValue; debería estar en Foot.Look.ReadValue. Preste atención a la ‘L’ mayúscula en “Mirar”. Este tutorial probablemente sea de Natty Creations.

C++
void LateUpdate()
{
     look.ProcessLook(OnFoot.Look.ReadValue<Vector2>());
}

コメント

タイトルとURLをコピーしました