using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.Universal; public class DyingLight : MonoBehaviour { Light2D l; public float speed = 0.5f; private void Awake() { l = GetComponent(); l.intensity = 0.5f; } void Update() { if(l.intensity < 0) { //Destroy(gameObject); } else { l.intensity -= Time.deltaTime * speed; } } }