Thiếu chỉ thị sử dụng hoặc tham chiếu lắp ráp

lập trình


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

Những gì tôi đã thử:

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


WHATS IN BOLD IS THE ERROR

Giải pháp 1

Trình biên dịch đang tìm kiếm thứ gọi là xem xét loại OnFootAction. Nếu bạn đã làm theo hướng dẫn một cách chính xác thì cú pháp đúng không phải là onFoot.look.ReadValue; nó phải là onFoot.Look.ReadValue. Hãy chú ý đến chữ ‘L’ viết hoa trong “Look”. Hướng dẫn này có thể được thực hiện bởi Natty Creations.

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

コメント

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