Hello. I never used 2d and i want to do a sidescroller camera for my characher. How do i do that? only in x. This is what i tried:
using UnityEngine;
using System.Collections;
public class CameraAnchor : MonoBehaviour {
public Transform player;
public float distance = 10f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void LateUpdate () {
transform.position = player.position + Vector3 (distance, 0, 0);
}
}
But it give me a error:
Expression denotes a type', where a
variable’, value' or
method group’ was expected
I hope someone can help me with this. I did try search in internet i keep getting the same error or the same code.