mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-05 07:41:10 +00:00
24 lines
712 B
C#
24 lines
712 B
C#
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace Assets._Project.Develop.Runtime.Utilities.SceneManagement
|
|
{
|
|
public class SceneLoaderService
|
|
{
|
|
public IEnumerator LoadAsync(string sceneName, LoadSceneMode loadSceneMode = LoadSceneMode.Single)
|
|
{
|
|
AsyncOperation wait = SceneManager.LoadSceneAsync(sceneName, loadSceneMode);
|
|
|
|
yield return new WaitWhile(() => wait.isDone == false);
|
|
}
|
|
|
|
public IEnumerator UnloadAsync(string sceneName)
|
|
{
|
|
AsyncOperation wait = SceneManager.UnloadSceneAsync(sceneName);
|
|
|
|
yield return new WaitWhile(() => wait.isDone == false);
|
|
}
|
|
}
|
|
}
|