Coroutines not passing yield

I have an issue with a level loader I’ve written where the following code is not completing:

IEnumerator LoadAsync(int i) {
	Debug.Log ("Loading...");
	aop = Application.LoadLevelAsync(i);
	aop.allowSceneActivation = false;
	Debug.Log ("Post-LLA");
	yield return aop;
	Debug.Log ("Load done time: " + Time.time);
	loading = false;
	levelReady = true;
	yield return new WaitForSeconds(1f);
	//aop.allowSceneActivation = true; (this happens in the Ready function)
	Ready ();
}

The aop variable is defined as an AsyncOperation. Some background here, I had another yield return new WaitForSeconds(1f) line preceding the yield return aop line, and it would hang on that as well. I get the debug output in the console before any yields. I’d originally started writing this as a problem with LoadLevelAsync/AdditiveAsync, but then discovered none of the yield calls were getting through. I’ve tried calling with both StartCoroutine(LoadAsync(i)) and (“LoadAsync”, i) just to make sure there wasn’t some odd change I missed.

It is being called from this function on an object tagged for DontDestroyOnLoad():

public void LoadLevel (int i) {
	loading = true; levelReady = false;
	Application.LoadLevel("Loading");
	PercentageID pid = FindObjectOfType<PercentageID>();
	if (pid != null) percentageText = pid.GetComponent<Text>();
	loadContent = GameObject.Find ("LoadingContent");
	Debug.Log ("Load start time: " + Time.time);
	StartCoroutine ("LoadAsync", i);
}

Any ideas on what’s happening? Is this a bug with the latest versions of Unity? (I was on 5.0.1 originally and now the current 5.0.2)

If you’re 100% sure that your object isn’t being destroyed, then I would suggest that you add a ‘yield return null’ at the very top of LoadAsync(). This is because Application.LoadLevel() doesn’t actually work right away and only loads the specified level at the end of the current frame. Without it, you’re effectively doing
Application.LoadLevel() and
Application.LoadLevelAsync()
on the same frame. Who knows how Unity will respond?