HierarchySafeDestory Method (GameObject) |
Destroys the object in a way which is safe for physical callback methods.
Namespace:
KSPDev.ModelUtils
Assembly:
KSPDev_Utils.1.2 (in KSPDev_Utils.1.2.dll) Version: 1.2 for KSP v1.6+
Syntaxpublic static void SafeDestory(
GameObject obj
)
Request Example
View SourceParameters
- obj
- Type: UnityEngineGameObject
The object to destroy.
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