protected override IEnumerator LoadScene(LevelScene scene, Action<float, string> progressDelegate) { /* * Old Chinese trick: When loading scene, some of the components in this scene may not be initialized by unity * In this situation, object.GetComponent<>() will not work on some game objects. * That is why we can just skip one frame and let unity finally do it's job. */ yield return null; /* * When loading scene, make sure LevelRoot knows about what scene it is currently in. * Find LevelDescriptor with the corresponding ID and assign it to the CurrentLevel property of the LevelRoot */ scene.LevelRoot.CurrentLevel = LevelManagementService.Levels.FirstOrDefault(level => level.Id == scene.Id); yield break; }
protected override IEnumerator LoadScene(LevelScene scene, Action <float, string> progressDelegate) { /* * Old Chinese trick: When loading scene, some of the components in this scene may not be initialized by unity * In this situation, object.GetComponent<>() will not work on some game objects. * That is why we can just skip one frame and let unity finally do it's job. */ yield return(null); /* * When loading scene, make sure LevelRoot knows about what scene it is currently in. * Find LevelDescriptor with the corresponding ID and assign it to the CurrentLevel property of the LevelRoot */ scene.LevelRoot.CurrentLevel = LevelManagementService.Levels.FirstOrDefault(level => level.Id == scene.Id); yield break; }
protected override IEnumerator UnloadScene(LevelScene scene, Action<float, string> progressDelegate) { yield break; }
protected override IEnumerator UnloadScene(LevelScene scene, Action <float, string> progressDelegate) { yield break; }