Il manque une directive using ou une référence d’assembly

la programmation


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

Ce que j’ai essayé :

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


WHATS IN BOLD IS THE ERROR

Solution 1

Le compilateur recherche quelque chose appelé look into the type OnFootAction. Si vous avez suivi le tutoriel avec précision, la syntaxe correcte n’est pas onFoot.look.ReadValue ; ce devrait être onFoot.Look.ReadValue. Faites attention au « L » majuscule dans « Regardez ». Ce tutoriel est probablement réalisé par Natty Creations.

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

コメント

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