Description
The DeleteEverything
property of the SceneLoadOptions
class determines whether all objects in the scene should be deleted upon loading, including those marked with the DontDelete
flag. This property is useful when you want to ensure a completely clean slate when loading a new scene, without retaining any objects from the previous state.
Usage
To use the DeleteEverything
property, create an instance of the SceneLoadOptions
class and set the property to true
if you want to delete all objects, including those marked as DontDelete
, when loading a scene. Set it to false
if you want to retain objects marked as DontDelete
.
Example
// Create a new instance of SceneLoadOptions
SceneLoadOptions loadOptions = new SceneLoadOptions();
// Set DeleteEverything to true to remove all objects, including those marked as DontDelete
loadOptions.DeleteEverything = true;
// Load the scene with the specified options
SceneFile sceneFile = loadOptions.GetSceneFile();
if (sceneFile != null)
{
// Assuming a method to load the scene exists
LoadScene(sceneFile, loadOptions);
}