DeleteWhenAble - ObjectReference
Revision as of 17:21, 15 April 2021 by imported>Pickysaurus (→Notes: Added result of an issue I found with this function.)
Member of: ObjectReference Script
Waits for this reference to lose its parent cell, or for its parent cell to become detached, then deletes it.
Syntax[edit | edit source]
Function DeleteWhenAble()
While GetParentCell() && GetParentCell().IsAttached()
Utility.Wait(5)
EndWhile
Delete()
EndFunction
Parameters[edit | edit source]
None.
Return Value[edit | edit source]
None.
Examples[edit | edit source]
; Deletes the specified reference when its parent cell is gone
TempReference.DeleteWhenAble()
Notes[edit | edit source]
- DeleteWhenAble() will pause the current script and will not return until the object has been deleted successfully.
- Using DeleteWhenAble() within a scene can cause it to stall. ( This needs independent verification. My assumption is that the scene is waiting for the operation to complete. )