SceneStateRestorer
Class in ChivalrousGames.Common / Implements : IDisposable
Description
Editor tool.
This class will make sure a scene is loaded and ready to be edited and will restore it to its initial state afterwards. If scene was not loaded, it will be loaded additively during processing
Usage Example
string result = string.Empty;
List scenePaths = SceneHelper.GetAllScenePaths();
foreach (string scenePath in scenePaths) {
using(SceneStateRestorer sceneStateRestorer = new SceneStateRestorer(scenePath)) {
//Here do whatever: count objets, CRUD stuff, etc
result += "scene \"" + sceneStateRestorer.Scene.name +"\": was modified; ";
}
}
Properties
Scene | Scene | ReadOnly Gets the scene. |
InitialSceneState | InitialSceneStateEnum | ReadOnly gets the state the scene was in before SceneStateRestorer opened it. It is also be the state to which the scene will be restored when SceneStateRestorer is disposed. |
Constructors
Constructor
public SceneStateRestorer(string scenePath);
Parameters
scenePath | string | Path toward the scene to open. |
Return
SceneStateRestorer | A new instance of SceneStateRestorer |
Description
Create a new SceneStateRestorer. Should always be used in the context of a using statement.
Usage Example
See Class usage example
Methods
Dispose
public void Dispose();
Description
Restores the scene to its initial state. Do not call this manually, the using statement will do this automatically for you.