Wait for audio to finish and then load scene

I keep forgetting how to do this.

using UnityEngine;
using System.Collections;

public class KittIDsounder : MonoBehaviour {


	public AudioClip KittID;

	// Use this for initialization
	void Start () {
			StartCoroutine(LoadKittID("MainScreen"));
		}

	IEnumerator LoadKittID(string level01){
			yield return new WaitForSeconds(12.0f); // wait time
		GetComponent<AudioSource>().PlayOneShot(KittID);

		yield return new WaitForSeconds(AudioClip.length);
		Application.LoadLevel(level01);
		}
	
	}

Try with AudioSource.isPlaying();
As long your audio is playing, keep your script away from loading the scene. If it’s done, toggle the last switch to let it load.

This seems to do the trick.

using UnityEngine;
using System.Collections;

public class KittIDsounder : MonoBehaviour {


	public AudioClip KittID;

	// Use this for initialization
	void Start () {
			StartCoroutine(LoadKittID("MainScreen"));
		}

	IEnumerator LoadKittID(string level01){
			yield return new WaitForSeconds(12.0f); // wait time
		GetComponent<AudioSource>().PlayOneShot(KittID);

		yield return new WaitForSeconds(10.0f);

		Application.LoadLevel(level01);
		}
	
	}