class
ScriptObjectWrapper
Extends IScriptObjectWrapper by keeping a strong reference to the script object, and releasing it as needed.
As well as providing an interface for script reload functionality. See IScriptObjectWrapper.
Public
Constructors
ScriptObjectWrapper
Methods
~ScriptObjectWrapper
GetScriptObject
BindToScriptObject
Stores a pointer to the wrapper in the script object.
This ensures that calls to GetScriptObjectWrapper() can return the script object wrapper associated with the script object.
GetNativeObjectReferenceCount
Returns the number of strong references on the underlying native object.
RegisterEvents
Used by derived classes to connect callbacks to native object events.
UnregisterEvents
Used by derived classes to disconnect callbacks to native object events.
NotifyScriptObjectDestroyed
Notifies the wrapper that the script object is about to be destroyed.
NotifyNativeObjectDestroyed
Notifies the wrapper that the native object it is managing is about to be destroyed.
ReleaseScriptObjectHandle
Releases the currently held script object strong handle, if any.
GetLifetimeTrackingMode
Determines how is script object lifetime tracked, and when should the native object be destroyed.
TransitionToWeakScriptObjectHandle
Changes the internal script object handle from strong to weak.
If the handle is already weak does nothing. Only relevant if lifetime tracking mode is using garbage collection.
TransitionToStrongScriptObjectHandle
Changes the internal script object handle from weak to strong.
If the handle is already strong does nothing. Only relevant if lifetime tracking mode is using garbage collection.
HasStrongScriptObjectHandle
Returns true if the currently held script object handle is strong (preventing the script GC from releasing the object).
ShouldPersistScriptReload
If true, the object will be given an opportunity to back up its data before a script reload operation, and its script object will be automatically recreated once script reload ends, and given an opportunity to restore the backed up data.
If false, the script object and its wrapper will be destroyed on script reload.
NotifyScriptWillReload
Called on all script object wrappers before script object reload happens.
BackupDataBeforeScriptReload
Called on all script object wrappers when script reload is about to happen.
Allows the script object to back up its current state so it may be restored after reload completes. Only relevant for script objects that persist script reload (i.e. ShouldPersistScriptReload() returns true).
RecreateScriptObjectAfterScriptReload
Called on all script object wrappers after script assemblies have been reloaded.
This needs to recreate the internal script object using the new assemblies, as the old one will have been destroyed during the reload. Only relevant for script objects that persist script reload (i.e. ShouldPersistScriptReload() returns true).
RestoreDataAfterScriptReload
Called on all script object wrappers after script objects have been created in RecreateScriptObjectAfterScriptReload().
Allows you to restore data backed up in BackupDataBeforeScriptReload() call to the newly created script object. Only relevant for script objects that persist script reload (i.e. ShouldPersistScriptReload() returns true).
NotifyScriptReloadFinished
Called on all script object wrappers as the final step in script reload, after RestoreDataAfterScriptReload().
Allows you to perform actions that require the entire scripting world to be fully recreated.
Protected
Methods
CreateScriptObjectHandle
Creates a new handle to the provided script object.
Previous handle must be released.