Description
The Destroy
method is a virtual method of the Scene
class in the Sandbox framework. It is used to destroy the current scene, effectively cleaning up all resources and objects associated with it. This method is typically called when you want to completely remove a scene from memory, ensuring that all associated game objects and components are properly disposed of.
Usage
To use the Destroy
method, simply call it on an instance of the Scene
class. This will initiate the destruction process for the scene, removing all game objects and components associated with it.
Note that this method is virtual, allowing for customization in derived classes if specific destruction behavior is needed.
Example
// Example of using the Destroy method
Scene currentScene = new Scene();
// Perform operations on the scene
// ...
// When done with the scene, destroy it
currentScene.Destroy();
// After calling Destroy, the scene and its resources are cleaned up.