IEnumerator PlayPuzzle() { GameObject prefab = Resources.Load <GameObject>(puzzlePath + puzzleObjectMap[puzzleIds[index].puzzleType]); currentPuzzle = Instantiate(prefab).GetComponent <PuzzleManager>(); currentPuzzle.onWon += OnWon; yield return(new WaitForEndOfFrame()); currentPuzzle.Play(puzzleIds[index].id); restartButton.SetVisible(currentPuzzle.canRestart); }