I can't get my camera's position to move with the player.
This is the CameraController.cs
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
public GameObject Player;
private Vector3 offset;
void Start()
{
transform.position = Player.transform.position;
}
void LateUpdate()
{
transform.position = Player.transform.position;
Debug.LogError(transform.position);
}
}
The script is a component of the main camera. The camera is not a child of the player object or vice versa.
The debugging says that the position is being updated to the player's position, but when the game is run the camera is static and doesn't move from its initial starting point.
offset
are unnecessary but this shouldn't have any effect on what you are trying to achieve. Are there any other scripts in your session that change the position of your camera? Are you getting any errors in the console? - Danny Herbert