`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraFollow : MonoBehaviour {
public Transform target;
// Update is called once per frame
void LateUpdate() {
if (target.position.y > transform.position.y)
{ //target is the Doodler
Vector3 newPos = new Vector3 (transform.position.x, target.position.y, transform.position.z);
transform.position = newPos;
//transform is the camera
}
}
}`
Hello! A complete newbie here trying to get some practice by trying to clone a Doodle jump.
I’m trying to find a way to make the camera follow the Doodler (the character), but I can’t seem to find what the issue is. It seems the camera does follow the player on the “scene” but not in the “game”.
Also, it seems that every time the Doodler is in an upward motion, the camera moves up, quickly making the scene out-of-sight.
The photos attached are my visual studio code and the unity main camera inspector.
I have a feeling it’s a simple mistake but again, I can’t seem to find what my error is! Any help would be appreciated
.Thank you.