OnUnload - ObjectReference

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

Event called when the object's 3d has been unloaded. This event is sent every time the 3d is unloaded, which may happen multiple times in a single game session.

Syntax[edit | edit source]

Event OnUnload()

Parameters[edit | edit source]

None.

Examples[edit | edit source]

Event OnUnload()
  Debug.Trace("This object has been unloaded, animations can't be played on it anymore")
endEvent

Notes[edit | edit source]

  • When this event is received any calls to the object that manipulate it may fail.
  • This event may not be sent if an object is in an unattached cell when a save is made, and then the save is loaded (the 3d is never loaded by the savegame process, so it never 'unloads'). Keeping track of the cell attach and cell detach events is usually more reliable.
  • This event is only sent when an object's 3d is unloaded. This may or may not have anything to do with its parent cell and/or the player's location in the world. Don't rely on it happening every time a player leaves the parent cell, even an interior.

See Also[edit | edit source]