[205770-my-project-samplescene-windows-mac-linux-unity-202.zip|205770]Hello fellow unity users,
I just started learning unity 5 days ago, and I am countering an issue on how can I make the camera follow the player. I have used multiple scripts from all over the internet and even used cinamachine but nothing seem to work. The camera object transform x and y keep decreasing constantly even though I am not moving the character. What should I do?
Here is the camera script
`using UnityEngine;
public class CameraFollow : MonoBehaviour
{
private Vector3 offset = new Vector3(0f, 0f, -10f);
private float smoothTime = 0.25f;
private Vector3 velocity = Vector3.zero;
[SerializeField] private Transform target;
private void Update()
{
Vector3 targetPosition = target.position + offset;
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
}
}
`
Kindly download the zip file containing a recording of what is happening.