I got this error and don’t know what the problem is in my script
Assets\Scripts\InputHandler.cs(32,31): error CS1061: ‘CameraHandler’ does not contain a definition for ‘FollowTarget’ and no accessible extension method ‘FollowTarget’ accepting a first argument of type ‘CameraHandler’ could be found (are you missing a using directive or an assembly reference?)
Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HR
{
public class InputHandler : MonoBehaviour
{
public float horizontal;
public float vertical;
public float moveAmount;
public float mouseX;
public float mouseY;
PlayerControls inputActions;
CameraHandler cameraHandler;
Vector2 movementInput;
Vector2 cameraInput;
private void Awake()
{
cameraHandler = CameraHandler.singleton;
}
private void FixedUpdate()
{
float delta = Time.fixedDeltaTime;
if (cameraHandler != null)
{
cameraHandler.FollowTarget(delta);
cameraHandler.HandleCameraRotation(delta, mouseX, mouseY);
}
}
public void OnEnable()
{
if (inputActions == null)
{
inputActions = new PlayerControls();
inputActions.PlayerMovement.Movement.performed += inputActions => movementInput = inputActions.ReadValue<Vector2>();
inputActions.PlayerMovement.Camera.performed += i => cameraInput = i.ReadValue<Vector2>();
}
inputActions.Enable();
}
private void OnDisable()
{
inputActions.Disable();
}
public void TickInput(float delta)
{
MoveInput(delta);
}
private void MoveInput(float delta)
{
horizontal = movementInput.x;
vertical = movementInput.y;
moveAmount = Mathf.Clamp01(Mathf.Abs(horizontal) + Mathf.Abs(vertical));
mouseX = cameraInput.x;
mouseY = cameraInput.y;
}
}
}