26 lines
608 B
C#
26 lines
608 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CamerFollow : MonoBehaviour
|
|
{
|
|
|
|
private Transform playerTransform;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
|
|
}
|
|
|
|
void LateUpdate()
|
|
{
|
|
// we store current camera's position here
|
|
Vector3 temp = transform.position;
|
|
temp.x = playerTransform.position.x;
|
|
temp.y = playerTransform.position.y;
|
|
transform.position = temp;
|
|
|
|
}
|
|
}
|