Audiosource switches clip, but doesn't seem to play?

I start the level off with a coroutine to fade in clip 1 named a1. That part works great. But I’ve got a trigger on the level, and i want the audiosource (aS) to switch to clip b1. In the inspector is shows that the clip has indeed switched, but it doesn’t seem to play, or perhaps is stuck retrying to play on the first bit of clip?

my code >>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BGMStageOneScript : MonoBehaviour
    public AudioSource aS;
    public AudioClip a1;
    public AudioClip b1;
    public float fadeTime = 0.02f;
    public GameObject player;

    private void Start()
        aS = GetComponent<AudioSource>();

    IEnumerator fadeinAudio()
        float startVolume = 0.005f;

        aS.volume = 0.0f;
        aS.clip = a1;

        while (aS.volume < 0.2f)
            aS.volume += startVolume * Time.deltaTime * fadeTime;

            yield return null;
        aS.volume = 0.2f;

    public void Update()
        if (player.GetComponent<PlayerDetection>().touchedT3) // trigger on the level

    public void SwitchClips()
        aS.volume = 0.2f;
        aS.clip = b1;

If anyone can help I’d really appreciate it! I’m almost finished with this game and this is the last hurdle!

Are you sure “player.GetComponent().touchedT3” be false after switch clips?

So, this is what I ended up doing.

You can’t have Update controlling the audio clip. so rather than waiting for a bool to switch to true, I created an OnTriggerEvent setup which called for the audio source to switch clips, works like a charm now. Live and learn.

every thing seems to be OK!
try this idea:
maybe stopCoroutine not work.
use this in class

private IEnumerator myFadeRoutine;

in start() use this:



in update()