ModHost Class |
Namespace: UMod
public sealed class ModHost : MonoBehaviour, IModHost, IModAsyncHandler
The ModHost type exposes the following members.
Name | Description | |
---|---|---|
AllLoadedModHosts | ||
AllModHosts |
Returns an array of references to all mod hosts currently in the scene regardless of their load state.
| |
Assets |
Returns the IModAssets interface for the current mod allowing asset loaading from the mod via the host.
| |
CanBeReclaimed |
When true, existing mod hosts that are in an idle state (Unloaded and not loading) may be reclaimed for reuse by
another mod load.
Calls to CreateNewHost or Load(Uri, Boolean) may result in host reclaims.
By default, this value is true.
| |
CurrentIdentity |
Returns an instance of the ModIdentityy class representing the current loaded mod or null if no mod is loaded.
| |
CurrentMod |
Returns the IModInfo interface for the the current mod allowing access to values such as mod name and version.
| |
CurrentModPath |
Returns the current mod path representing the loaded mod location as specified in the Load(Uri, Boolean) method.
If no mod is loaded then the return value will be null.
Note that the mod path may be set before the host has actually loaded the mod so it is reccommended that you also check IsModLoading | |
DebugHandler |
Returns the ModDebugHandler for the current mod and can be used to log useful debug messages.
| |
DownloadSpeed |
Get the current DownloadSpeed for this mod host.
This value will only be used when IsModDownloading is true.
| |
HasAssets |
Returns true if the current loaded mod contains any prefab assets.
| |
HasDependencies |
Returns true if the current mod is dependant upon any other mods.
| |
HasScenes |
Returns true if the current loaded mod contains any scenes.
| |
HasScripts |
Returns true if the current loaded mod contains any code assets.
Code assets can be in the form of C# scripts or managed assemblies and both will be treated as 'Scripts'
| |
HostDependencies |
Get an array of ModHost that this host is dependant upon in order to function correclty.
This array will only be populated once this host has finished loading its hosted mod.
| |
IsModActivated |
Returns true if this mod host has been activated.
Activation causes the mod content to be initialized. Without activation, the content is not accessible.
| |
IsModDownloading |
Returns true if this mod host is currently downloading from a remote server or reading from the local file system.
| |
IsModLoaded |
Returns true if this mod host currently has a mod loaded otherwise returns false.
| |
IsModLoading |
Returns true if this mod host is currently loading a mod otherwise returns false.
| |
LoadResult |
Returns the ModLoadResult for the last load attempt.
| |
ReferencedMods |
Get and array of IModInfo that the current mod references.
| |
Scenes |
Returns the IModScenes interface for the current mod allowing scene loading from the mod via the host.
| |
ScriptDomain |
Access the script domain for this mod.
If the host does not have a mod loaded then the return value will be null.
| |
SharedAssets |
Returns the IModAssets interface for the current mod allowing shared asset loading from the mod via the host.
Shared assets include all referenced mod assets reccursivley as well as this mods assets.
| |
SharedScenes |
Returns the IModScenes interface for the current mod allowing scene loading from the mod via the host.
Shared scenes include all referenced mod scenes reccursivley as well as this mods scenes.
|
Name | Description | |
---|---|---|
Activate |
Activates all mod content.
All mod asset and scene information will become available.
The default scene may be loaded depending upon the mod settings.
All mod entry point scripts will be security checked, initialized and executed.
| |
CreateNewHost |
Static methods that provides a quick and simple method of creating a new mod host component in the scene.
The method will create associated game objects and dependant components automatically to ensure that the created
host is valid.
| |
DestroyModObjects |
Destroys all active game objects that have been created by this mod.
This may be called automatically as a result of calling UnloadMod depending upon the value of cleanupModObjects.
This method needs the mod to be loaded in order to succeed. If the mod has been unloaded and this method is called then it will fail silently.
| |
IsModInUse |
Returns true if any mod host currently has the specified mod loaded.
This method is used to avoid shared memory corruption which orrurs when the shared mod data is accessed by 2 different mod hosts.
| |
UnloadMod |
Attempts to unload the mod owned by this host.
If the host does not have a mod loaded then no action is taken.
| |
UnloadMod(Boolean) |
Attempts to unload the mod owned by this host. Depending on settings this may cause all mod related game objects to
also be destroyed.
If the host does not have a mod loaded then no action is taken.
|
Name | Description | |
---|---|---|
OnModUnloaded |
This event is triggered after a host has unloaded an existing mod from memory.
Only triggered when the host actually has a mod loaded.
| |
OnModWillUnload |
This event is triggered just before a mod is about to be unloaded.
This allows you to perform cleanup tasks or similar before the mod is destroyed.
Only triggered when the host actually has a mod loaded.
|
Name | Description | |
---|---|---|
IModAsyncHandlerRunAsync |