Unity 4.3 crashes setting objects inactive

Apperently Unity doesn’t like to set a bunch of objects to inactive. Whenever I loop through these child objects and use setActive to turn them off, Unity Crashes to the desktop.

Is this a bug or am I a victim of my own stupidity?

foreach (Transform level in levels.transform) {
   level.gameObject.SetActive(false);
}

SetActive() is recursive into child objects, so try just calling SetActive(false) on the parent “levels” object without the loop.

I found another solution. Someone else also discribed this as a 4.3 bug.
The function is called from the last frame of an animation, as an animation event.

However, somehow Unity doesn’t like to handle a SetActive loop on the last frame of an animation. So a little workaround was to start a coroutine with a WaitForEndOfFrame() before going through the setActive loop.

public void OnAnimationEnd() {
   StartCoroutine("Delay");
}

private IEnumerator Delay() {
   yield return new WaitForEndOfFrame();

   foreach (Transform level in levels.transform) {
      level.gameObject.SetActive(false);
   }
}