Code used in the video:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour {
[SerializeField] Transform player;
float offsetX = 3.0f;
// Use this for initialization
void Start () {
//player = GameObject.Find("Player").GetComponent<Transform>();
}
// Update is called once per frame
void Update () {
transform.position = new Vector3(player.position.x + offsetX,transform.position.y,transform.position.z);
}
}
No comments:
Post a Comment