Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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();
    }
}


What I have tried:

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


WHATS IN BOLD IS THE ERROR
Posted
Updated 18-Dec-23 9:24am
v2
Comments
Dave Kreskowiak 18-Dec-23 15:24pm    
This is not C++, it's C#. I've updated the tag on your question.

1 solution

The compiler is looking for something called look into the type OnFootAction, If you've followed the tutorial accurately, the correct syntax is not onFoot.look.ReadValue; it should be onFoot.Look.ReadValue. Pay attention to the capital 'L' in "Look." This tutorial is likely by Natty Creations.
C++
void LateUpdate()
{
     look.ProcessLook(OnFoot.Look.ReadValue<Vector2>());
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900