Below is two type of camera control to follow a player. One is simply look at the player.
using UnityEngine;
using System.Collections;
public class cameraLookAt : MonoBehaviour {
public Transform myObject;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
transform.LookAt(myObject);
}
}
Second is to follow the movement of the player, third person camera.
using UnityEngine;
using System.Collections;
public class ThirdPersonCamera : MonoBehaviour {
public GameObject myObject;
private Vector3 offset;
// Use this for initialization
void Start () {
offset = transform.position - myObject.transform.position;
}
// Update is called once per frame
void Update () {
transform.position = myObject.transform.position + offset;
}
}