HierarchySafeDestory Method (Component) |
Destroys the object in a way which is safe for physical callback methods.
Namespace:
KSPDev.ModelUtils
Assembly:
KSPDev_Utils.2.0 (in KSPDev_Utils.2.0.dll) Version: 2.0 for KSP v1.8+
Syntaxpublic static void SafeDestory(
Component obj
)
Request Example
View SourceParameters
- obj
- Type: Component
The object to destroy. Can be null.
Remarks
The Unity UnityEngine.Object.Destroy method only marks object for deletion, but before
the next fixed frame cycle completed, the object still can be found in the hierarchy. And it
may trigger physics before the final cleanup. This method ensures that none of these
side-effects happen and it doesn't use physics incompatible DestroyImmediate
method.
See Also