Scriptum/Assets/HardLight2D/Scripts/LightFollow.cs

25 lines
587 B
C#
Raw Normal View History

2022-12-29 03:22:45 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LightFollow : 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-0.2f;
transform.position = temp;
}
}