WaitForSeconds() not working in Unity 5

EDIT:
Ok, so for some reason the code above just started working out of nowhere, but my code here still doesn’t work. What my code is supposed to do is change the speed of another gameobject, then change it back after a certain amount of time. Here’s where it gets called: (it’s right at the end of this code)

using UnityEngine;
using System.Collections;

public class TrapBehaviour : MonoBehaviour {
	
	[Range(0, 1)]
	public float slowAmount = 0f;
	public bool stopEnemy = false;
	public float movementEffectTime = 1f;

	public float damageAmt = 6f;
	public float extraRange = 0f;

	public bool fireOverTime = false;
	public float fireTime = 2f;
	public float fireDmgPerSec = 1f;

	/*void Start() {
		print("Starting " + Time.time);
		StartCoroutine(WaitAndPrint(2.0F));
		print("Before WaitAndPrint Finishes " + Time.time);
	}
	
	IEnumerator WaitAndPrint(float waitTime) {
		yield return new WaitForSeconds(waitTime);
		print("WaitAndPrint " + Time.time);
	}*/
	
	void OnTriggerEnter2D(Collider2D coll) {
		if (coll.gameObject.layer == 9) {
			//Debug.Log("Trap");
			ApplyEffects(coll.gameObject);
			Destroy(gameObject);
		}
		//Debug.Log ("Hit");
	}

	void ApplyEffects(GameObject enemy) {
		EnemyHealth en = enemy.GetComponent<EnemyHealth> ();
		EnemyAI ea = enemy.GetComponent<EnemyAI> ();

		if (damageAmt > 0) {
			en.TakeDamage (damageAmt);
		}

		if (stopEnemy == true) {
			ea.SlowEffect (0f, movementEffectTime);
		} 

		if (slowAmount > 0) {
			Debug.Log("Called");
			StartCoroutine(ea.SlowEffect (slowAmount, movementEffectTime));
		}
	}
}

And here’s where it’s received:

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {

	public float speed = 1f;
	public float randomizeSpeed = 0f;
	public bool attackPlayer = false;
	public bool switchY = false;
	public bool switchX = true;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		EnemyMove (speed, switchX, switchY);
	}

	void EnemyMove(float mSpeed, bool sSwitchX, bool sSwitchY) {
		Vector2 nVelocity = Vector2.zero;

		if (sSwitchX) {
			nVelocity = new Vector2(nVelocity.x + (speed*Time.deltaTime), nVelocity.y);
		}

		transform.Translate (nVelocity);
	}

	public IEnumerator SlowEffect(float maginitude, float time) {
		speed *= maginitude;
		Debug.Log ("received");
		yield return new WaitForSeconds (1f);
		speed /= maginitude;
		Debug.Log ("Done");
	}
}

I get ‘received’ in the console, but no matter how long I wait (I’ve waited up to a minute), I never get ‘Done’ in the console.

One thing that could be a problem: the gameobject that called the coroutine is destroyed before the WaitForSeconds is over. Is this a problem? Notice any other problems?

There are no issues with coroutines or WaitForSeconds in Unity 5, and your code works as expected (tested). Could be you did something like set the timescale to 0.

Check if your Time.TimeScale is not 0. If it is, set it to 1

I found the problem. I was calling a coroutine in another script like this: StartCoroutine(script.methodName()), when I should have done it like this: script.StartCoroutine(script.methodName()). So I just needed the ‘script.’ at the start of the statement;