I am using this script which makes the character follow the camera but the camera view shifts to the left side of the screen in play mode also it moves on the X-axis along with the character, which i don’t want. I want the camera to move only in the Z-axis, also the camera stutters a bit :
Here’s the script:
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Start () {
offset= transform.position;
}
// Update is called once per frame
void LateUpdate () {
transform.position = player.transform.position+offset;
}
}