<aside> 📄 This script plays an AudioClip after a certain amount of time.

</aside>

using UnityEngine;

public class TimedSpatialAudio : MonoBehaviour
{
    [Tooltip("Time in seconds after scene start to play the sound.")]
    public float delayTime = 30f;

    [Tooltip("Audio clip to play.")]
    public AudioClip audioClip;

    private AudioSource audioSource;
    private float timer = 0f;
    private bool hasPlayed = false;

    void Start()
    {
        audioSource = GetComponent<AudioSource>();

        // Optional: assign clip via script if not already assigned in AudioSource
        if (audioClip != null)
        {
            audioSource.clip = audioClip;
        }
    }

    void Update()
    {
        if (hasPlayed) return;

        timer += Time.deltaTime;

        if (timer >= delayTime)
        {
            audioSource.Play();
            hasPlayed = true;
        }
    }
}