【解決方法】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

コンパイラは、OnFootAction 型の look into と呼ばれるものを探しています。チュートリアルに正確に従った場合、正しい構文は onFoot.look.ReadValue ではありません。 onFoot.Look.ReadValue である必要があります。 「Look」の大文字の「L」に注目してください。 このチュートリアルはおそらく Natty Creations によるものです。

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

コメント

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