Method Destroy
Destroy(Object, bool)
Calls the proper Destroy method on an object based on if application is playing.
Declaration
public static void Destroy(Object obj, bool withUndo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | Object to be destroyed. |
| bool | withUndo | Whether to record and undo operation for the destroy action. |
Remarks
In Play mode or when running your built application, this function calls Destroy.
In the Editor, outside of Play mode, this function calls DestroyImmediate.