void Destroy()

book_4_sparkGenerated
code_blocksInput

Description

The Destroy method is a virtual method of the PrefabScene class in the Sandbox API. It is used to destroy the current instance of the PrefabScene, effectively cleaning up any resources or references associated with it. This method is typically called when the scene is no longer needed, ensuring that memory and resources are properly released.

Usage

To use the Destroy method, simply call it on an instance of PrefabScene when you want to remove the scene and free up resources. This is particularly useful in scenarios where scenes are dynamically loaded and unloaded during the lifecycle of a game or application.

Note that since Destroy is a virtual method, it can be overridden in derived classes to provide custom destruction logic if necessary.

Example

// Example of using the Destroy method on a PrefabScene instance
PrefabScene myScene = new PrefabScene();

// Perform operations with myScene

// When done with the scene, destroy it to free resources
myScene.Destroy();