'How to make 2D Flickering light in Unity?

i need help, please. I just need to make flickering 2Dlight (using Unviversal Pipeline). After some time, the light begins to flickering and returns to its original value(light.intensivity = 0.36f), and after some time he start flickering again. But with this bad code i can't do that, flickering only works because coroutine everytime restarting(StartCoroutine(LightFlicker()); in coroutine). but i don't have ideas anymore how to make this thing. Maybe use another method to flickering light ?

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering.Universal;
using UnityEngine.Experimental;

using UnityEngine.Experimental.Rendering.LWRP;



public class FlickeringLight : MonoBehaviour {
    public UnityEngine.Experimental.Rendering.Universal.Light2D renderLight;
    public AudioSource AS; // AudioSource to play the audio.
    public AudioClip LightAudio; // Audio to play. 
    [SerializeField] float firstValue = 0f;
    [SerializeField] float secondValue = 0.36f;
    [SerializeField] float secondsBetweenFlickers = 2f;

    void Start ()
    {
        renderLight.intensity = renderLight.intensity;
        StartCoroutine(LightFlicker());
    }
    private void Awake()
    {
    renderLight = GetComponent​<UnityEngine.Experimental.Rendering.Universal.Light2D​>();
    }

    IEnumerator LightFlicker()
    {    
            renderLight.intensity = Random.Range(firstValue, secondValue);
            yield return new WaitForSeconds(secondsBetweenFlickers);
            AS.PlayOneShot(LightAudio); // Play the audio.
            StartCoroutine(LightFlicker());
    }

    //failed try to pause Coroutine LightFLicker
   /* IEnumerator TimerLight()
    {
        StopCoroutine(LightFlicker());
        renderLight.intensity = 0.36f;
        yield return new WaitForSeconds(3f);
        StartCoroutine(LightFlicker());
     
    }
   */
   
}```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source