void DestroyImmediate()

robot_2Generated
code_blocksInput

Description

Destroy this object immediately. Calling this might cause some problems if functions are expecting the object to still exist, so it's not always a good idea.

Usage

Use DestroyImmediate when you need to remove a GameObject from the scene immediately. Be cautious when using this method, as it can lead to unexpected behavior if other parts of your code are still referencing the object.

Example

// Example of using DestroyImmediate
GameObject myObject = new GameObject();
// Perform operations on myObject
// ...
// Now destroy it immediately
myObject.DestroyImmediate();
// myObject is now destroyed and should not be used further