Click or drag to resize

ModHost Class

The main mod component that provides access to loading and running a user created mod.
Inheritance Hierarchy
SystemObject
  Object
    Component
      Behaviour
        MonoBehaviour
          UModModHost

Namespace:  UMod
Assembly:  UMod (in UMod.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public sealed class ModHost : MonoBehaviour, 
	IModHost, IModAsyncHandler

The ModHost type exposes the following members.

Constructors
  NameDescription
Public methodModHost
Initializes a new instance of the ModHost class
Top
Properties
  NameDescription
Public propertyStatic memberAllLoadedModHosts
Public propertyStatic memberAllModHosts
Returns an array of references to all mod hosts currently in the scene regardless of their load state.
Public propertyAssets
Returns the IModAssets interface for the current mod allowing asset loaading from the mod via the host.
Public propertyCanBeReclaimed
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.
Public propertyCurrentIdentity
Returns an instance of the ModIdentityy class representing the current loaded mod or null if no mod is loaded.
Public propertyCurrentMod
Returns the IModInfo interface for the the current mod allowing access to values such as mod name and version.
Public propertyCurrentModPath
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
Public propertyDebugHandler
Returns the ModDebugHandler for the current mod and can be used to log useful debug messages.
Public propertyDownloadSpeed
Get the current DownloadSpeed for this mod host. This value will only be used when IsModDownloading is true.
Public propertyHasAssets
Returns true if the current loaded mod contains any prefab assets.
Public propertyHasDependencies
Returns true if the current mod is dependant upon any other mods.
Public propertyHasScenes
Returns true if the current loaded mod contains any scenes.
Public propertyHasScripts
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'
Public propertyHostDependencies
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.
Public propertyIsModActivated
Returns true if this mod host has been activated. Activation causes the mod content to be initialized. Without activation, the content is not accessible.
Public propertyIsModDownloading
Returns true if this mod host is currently downloading from a remote server or reading from the local file system.
Public propertyIsModLoaded
Returns true if this mod host currently has a mod loaded otherwise returns false.
Public propertyIsModLoading
Returns true if this mod host is currently loading a mod otherwise returns false.
Public propertyLoadResult
Returns the ModLoadResult for the last load attempt.
Public propertyReferencedMods
Get and array of IModInfo that the current mod references.
Public propertyScenes
Returns the IModScenes interface for the current mod allowing scene loading from the mod via the host.
Public propertyScriptDomain
Access the script domain for this mod. If the host does not have a mod loaded then the return value will be null.
Public propertySharedAssets
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.
Public propertySharedScenes
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.
Top
Methods
  NameDescription
Public methodActivate
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.
Public methodStatic memberCreateNewHost
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.
Public methodDestroyModObjects
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.
Public methodStatic memberIsModInUse
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.
Public methodUnloadMod
Attempts to unload the mod owned by this host. If the host does not have a mod loaded then no action is taken.
Public methodUnloadMod(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.
Top
Events
  NameDescription
Public eventOnModUnloaded
This event is triggered after a host has unloaded an existing mod from memory. Only triggered when the host actually has a mod loaded.
Public eventOnModWillUnload
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.
Top
Explicit Interface Implementations
See Also