缺少 using 指令或程序集引用


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();
    }
}

我尝试过的:

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


WHATS IN BOLD IS THE ERROR

解决方案1

编译器正在寻找名为“look into the type OnFootAction”的东西,如果您准确地遵循了教程,则正确的语法不是 onFoot.look.ReadValue; 它应该是 onFoot.Look.ReadValue。 注意“Look”中的大写“L”。 本教程可能由 Natty Creations 编写。

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

コメント

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