void Update()
    {
        if (!m_Playing || m_Paused)
        {
            return;
        }

        if (!m_AudioSource.isPlaying)
        {
            if (m_Playlist == null || m_Playlist.tracksCount == 0)
            {
                return;
            }

            if (m_NextIndex < 0 || m_NextIndex >= m_Playlist.tracksCount)
            {
                return;
            }

            AudioClip track = m_Playlist.GetTrack(m_NextIndex);
            m_AudioSource.clip = track;
            m_AudioSource.Play();

            m_NextIndex = (m_NextIndex + 1) % m_Playlist.tracksCount;
        }
    }