I keep on getting the error CS1061 and don’t know how to fix it: Assets\Scripts\PlayerInteract.cs(37,34): error CS1061: ‘InputManager’ does not contain a definition for ‘OnFoot’ and no accessible extension method ‘OnFoot’ accepting a first argument of type ‘InputManager’ could be found (are you missing a using directive or an assembly reference?) I have tried numerous things in order to try and fix it but I can’t find a way to. I have tried to redo the script entirely but it just doesn’t work, so I would appreciate some support so I can fix this so I will know how to handle this in the future. Here is the code. Any type of help would be much appreciated.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInteract : MonoBehaviour
{
private Camera cam;
[SerializeField]
private float distance = 3f;
[SerializeField]
private LayerMask mask;
private PlayerUI playerUI;
private InputManager inputManager;
// Start is called before the first frame update
void Start()
{
cam = GetComponent<PlayerLook>().cam;
playerUI = GetComponent<PlayerUI>();
inputManager = GetComponent<InputManager>();
}
// Update is called once per frame
void Update()
{
playerUI.UpdateText(string.Empty);
//this is just creating the ray cast or the line that comes out from your player to detect things like collisions
Ray ray = new Ray(cam.transform.position, cam.transform.forward);
Debug.DrawRay(ray.origin, ray.direction * distance);
RaycastHit hitInfo; //this stores what collisions have happened
if (Physics.Raycast(ray, out hitInfo, distance, mask))
{
if(hitInfo.collider.GetComponent<Interactable>() != null)
{
playerUI.UpdateText(hitInfo.collider.GetComponent<Interactable>().promptMessage);
if (inputManager.OnFoot.Interact.trigerred)
{
}
}
}
}
}