7. Materials, light, and particles

Asset importing

Materials

Reflection probe

Lights

using System.Collections;
using UnityEngine;

public class SpotlightFlicker : MonoBehaviour
{
    public float flickerInterval = 0.1f; // Time between flickers
    public float flickerChance = 0.5f; // Chance of flicker occurring

    private Light spotlight; // Reference to the spotlight component

    void Start()
    {
        // Get the Light component attached to this GameObject
        spotlight = GetComponent<Light>();

        // Start the flickering coroutine
        StartCoroutine(Flicker());
    }

    IEnumerator Flicker()
    {
        while (true)
        {
            // Randomly decide whether to flicker
            if (Random.value < flickerChance)
            {
                // Toggle the spotlight on or off
                spotlight.enabled = !spotlight.enabled;
            }

            // Wait for the flicker interval
            yield return new WaitForSeconds(flickerInterval);
        }
    }
}

Particles

< ^ >