OnUnload - ObjectReference

From Creation Kit
Jump to: navigation, 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

Event OnUnload()

Parameters

None.

Examples

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

Notes

  • 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