how to make you camera follow your player unity 3d code example
Example 1: how to make camera follow player unity 2d
public class CameraFollow : MonoBehaviour {
public GameObject Target;
private Vector3 Offset;
void Start() {
Offset = transform.position - Target.transform.position;
}
void Update() {
transform.position = Target.transform.position+Offset;
}
}
Example 2: linerenderer follow camera unity
You can render the line using a dedicated camera. Use .depth to control the order in which cameras render (i.e. render the line on top of -everything-), and .cullingMask to define what each camera renders (or not).
http://unity3d.com/support/documentation/ScriptReference/Camera-depth.html
http://unity3d.com/support/documentation/ScriptReference/Camera-cullingMask.html