/// <summary> /// Finds a scene, filtering by category. /// </summary> static public SceneBinding FindScene(SceneCategories inCategories) { foreach (var scene in FindScenes(inCategories)) { return(scene); } return(default(SceneBinding)); }
/// <summary> /// Finds a scene, filtering by id and category. /// </summary> static public SceneBinding FindSceneById(StringHash32 inId, SceneCategories inCategories) { foreach (var scene in FindScenes(inCategories)) { if (scene.Id == inId) { return(scene); } } return(default(SceneBinding)); }
/// <summary> /// Finds a scene, filtering by path and category. /// </summary> static public SceneBinding FindSceneByPath(string inPathFilter, SceneCategories inCategories) { foreach (var scene in FindScenes(inCategories)) { if (StringUtils.WildcardMatch(scene.Path, inPathFilter)) { return(scene); } } return(default(SceneBinding)); }
/// <summary> /// Finds scenes, filtering by category. /// </summary> static public IEnumerable <SceneBinding> FindScenes(SceneCategories inCategories) { bool bBuild = (inCategories & SceneCategories.Build) == SceneCategories.Build; bool bLoaded = (inCategories & SceneCategories.Loaded) == SceneCategories.Loaded; bool bActive = (inCategories & SceneCategories.ActiveOnly) == SceneCategories.ActiveOnly; bool bIncludeIgnored = (inCategories & SceneCategories.IncludeIgnored) == SceneCategories.IncludeIgnored; if (bActive) { SceneBinding active = SceneManager.GetActiveScene(); if (!bIncludeIgnored && IsIgnored(active)) { yield break; } if (bBuild && active.BuildIndex < 0) { yield break; } if (bLoaded && !active.IsLoaded()) { yield break; } yield return(active); } else if (bBuild) { foreach (var scene in AllBuildScenes(bIncludeIgnored)) { if (bLoaded && !scene.IsLoaded()) { continue; } yield return(scene); } } else if (bLoaded) { foreach (var scene in AllLoadedScenes(bIncludeIgnored)) { yield return(scene); } } }
/// <summary> /// Finds scenes, filtering by path and category. /// </summary> static public IEnumerable <SceneBinding> FindScenesByPath(string inPathFilter, SceneCategories inCategories = SceneCategories.Loaded) { foreach (var scene in FindScenes(inCategories)) { if (StringUtils.WildcardMatch(scene.Path, inPathFilter)) { yield return(scene); } } }
/// <summary> /// Finds scenes, filtering by name and category. /// </summary> static public IEnumerable <SceneBinding> FindScenesByName(string inNameFilter, SceneCategories inCategories) { foreach (var scene in FindScenes(inCategories)) { if (StringUtils.WildcardMatch(scene.Name, inNameFilter)) { yield return(scene); } } }