using UnityEngine; public class FlickerLight : MonoBehaviour { [SerializeField] float baseIntensity = 8f; [SerializeField] float flickerAmount = 2f; [SerializeField] float speed = 1.5f; Light _light; float _offset; void Start() { _light = GetComponent(); if (_light) baseIntensity = _light.intensity; _offset = Random.value * 100f; } void Update() { if (!_light) return; float t = Time.time * speed + _offset; float noise = Mathf.PerlinNoise(t, _offset) * 2f - 1f; noise += (Mathf.PerlinNoise(t * 2.7f, _offset + 50f) * 2f - 1f) * 0.4f; _light.intensity = baseIntensity + noise * flickerAmount; } }