Delete - ObjectReference

From the CreationKit Wiki
Revision as of 23:30, 14 April 2016 by imported>DavidJCobb (I'm pretty sure that the variable you call Delete() on can delay or prevent a deletion if you don't clear its value. Delete() doesn't return a value, so it has no way of clearing the variable you call it on. Reverting last change accordingly.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: ObjectReference Script

Flags this object reference as wanting to be deleted. A reference that is flagged for delete will be deleted as soon as:

  • It is no longer in a script property
  • It is no longer registered for updates
  • It is no longer being watched for Anim Events
  • It is no longer held in a quest Alias

Only references created in game can actually be deleted.

Syntax[edit | edit source]

Function Delete() native

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Deletes the specified reference
TempReference.Delete()

Notes[edit | edit source]

  • Delete is valid for unique actors only. Please waive from using it on respwning/leveled actors. It will destroy spawn points as you will not delete the spawned actor, but the leveled instance marker. Please use code similar to this to prevent respawn destruction. SetCriticalStage - Actor Source
Victim.SetCriticalStage(Victim.CritStage_DisintegrateEnd)
  • Remember that Delete() only flags an object for deletion; the actual deletion takes place later. Per this USKP discussion, if a variable still points to the object, the object will remain temporarily persistent; the deletion won't occur until that variable is cleared (i.e. by setting it to None).

See Also[edit | edit source]