Hey there, I’m just trying to make a simple script that lets a camera follow a character since parenting the camera doesn’t work. For whatever reason, none of the variables appear in the editor, so naturally it runs into issues since I can’t drag the character into the variable slot. Anyone know what’s going on? Here’s the code:
using UnityEngine;
using System.Collections;
public class cameraTracking : MonoBehaviour {
public GameObject targetl;
public float xOffset = 0;
public float yOffset = 0;
public float zOffset = 0;
void LateUpdate() {
this.transform.position = new Vector3(target.transform.position.x + xOffset,
target.transform.position.y + yOffset,
target.transform.position.z + zOffset);
}
}