// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) VRMADA, All rights reserved. // // -------------------------------------------------------------------------------------------------------------------- using System.Threading; using System.Threading.Tasks; using UltimateXR.Extensions.Unity.IO; using UnityEngine.SceneManagement; namespace UltimateXR.Extensions.Unity { /// /// extensions. /// public sealed class SceneManagerExt : SceneManager { #region Public Methods /// /// Creates an awaitable task that asynchronously loads a new scene. /// /// Scene to load /// Mode in which the scene will be loaded /// Optional cancellation token, to cancel the task /// Awaitable task public static Task Load(string sceneName, LoadSceneMode mode, CancellationToken ct = default) { return LoadSceneAsync(sceneName, mode).Wait(ct); } /// /// Creates an awaitable task that asynchronously unloads a scene. /// /// Scene to unload /// Optional cancellation token, to cancel the task /// Awaitable task public static Task Unload(string sceneName, CancellationToken ct = default) { return UnloadSceneAsync(sceneName).Wait(ct); } #endregion } }