class
ScriptObjectManager
Keeps track of all script interop objects and handles assembly refresh.
Public
Constructors
ScriptObjectManager
Methods
~ScriptObjectManager
RegisterScriptObjectWrapper
Registers a newly created script object wrapper.
UnregisterScriptObjectWrapper
Unregisters a script object wrapper that is no longer valid.
RefreshAssemblies
Refreshes the list of active assemblies.
Unloads all current assemblies and loads the newly provided set. This involves backup up managed object data, destroying all managed objects and restoring the objects after reload.
- assemblies
- A list of assembly names and paths to load. First value represents the assembly name, and second a path its the assembly .dll. Assemblies will be loaded in order specified.
Update
Called once per frame.
Triggers garbage collection and queued finalizer callbacks.
NotifyObjectFinalized
Call this when object finalizer is triggered.
At the end of the frame all objects queued with this method will have their NotifyScriptObjectDestroyed() methods triggered.
ProcessFinalizedObjects
Triggers _onManagedInstanceDeleted deleted callbacks on all objects that were finalized this frame.
This allows the native portions of those objects to properly clean up any resources. lets the script objects know if finalization is happening due to assembly refresh.
staticInstance
Returns a reference to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticInstancePtr
Returns a pointer to the module instance.
Module has to have been started up first otherwise an exception will be thrown.
staticShutDown
Shuts down this module and frees any resources it is using.
staticIsStarted
Query if the module has been started.
Fields
OnRefreshStarted
Triggered just before the assembly refresh starts.
At this point all managed objects are still valid, but are about to be destroyed. You should release any relevant object references at this point.
OnWillUnloadAssemblies
Triggered when all non-persistent objects were destroyed during assembly refresh, just before managed assemblies will be unloaded.
You should clear any assembly information at this point.
OnRefreshAssembliesLoaded
Triggered right after a domain was reloaded.
This signals the outside world that they should update any kept Mono references as the old ones will no longer be valid. You should reload assembly information at this point.
OnRefreshComplete
Triggered after the assembly refresh ends.
Persistent objects will be restored at this point. Use this to create new object handles if necessary.
Protected
Methods
~Module<T>
OnStartUp
Override if you want your module to be notified once it has been constructed and started.
OnShutDown
Override if you want your module to be notified just before it is deleted.
staticInstanceInternal
Returns a singleton instance of this module.
Private
Methods
PerformGarbageCollection
Iterates over all active script object wrappers and finds wrappers that contain native objects referenced purely by script object (reference count == 1).
Strong handles on such script objects are released so they may be freed when the last script object goes out of scope.