Unity Reference Docs
ModIO
| Type | Name | Description |
|---|---|---|
AuthenticationServiceProviderExtensions | AuthenticationServiceProviderExtensions | |
BuildSettings | BuildSettings | Build-specific configuration values. This can be setup directly from the inspector when editing the config settings file, or you can instantiate and use this at runtime with the Initialize method |
CommentDetails | CommentDetails | |
CommentPage | CommentPage | A struct containing the ModComments and total number of remaining results that can be acquired with the SearchFilter used in the GetMods request. |
DownloadReference | DownloadReference | Used in ModIOUnity.DownloadTexture() to get the Texture. (DownloadReference is serializable with Unity's JsonUtility) |
Entitlement | Entitlement | A struct representing all of the information available for an Entitlement. |
InstalledMod | InstalledMod | Struct used to represent a mod that already exists on the current device. You can view the subscribed users to this mod as well as the directory and modprofile associated to it. |
ModComment | ModComment | |
ModDependencies | ModDependencies | A struct representing all of the information available for a Mod's Dependencies. |
ModIOUnity | ModIOUnity | Main interface for the mod.io Unity plugin. |
ModIOUnityAsync | ModIOUnityAsync | Main async interface for the mod.io Unity plugin. |
ModIOUnityEvents | ModIOUnityEvents | |
ModId | ModId | A struct representing the globally unique identifier for a specific mod profile. |
ModPage | ModPage | A struct containing the ModProfiles and total number of remaining results that can be acquired with the SearchFilter used in the GetMods request. |
ModProfile | ModProfile | A struct representing all of the information available for a ModProfile. |
ModProfileDetails | ModProfileDetails | Use this class to fill out the details of a Mod Profile that you'd like to create or edit. If you're submitting this via CreateModProfile you must assign values to logo, name and summary, otherwise the submission will be rejected (All fields except modId are optional if submitting this via EditModProfile) |
ModStats | ModStats | Detailed stats about a Mod's ratings, downloads, subscribers, popularity etc |
ModfileDetails | ModfileDetails | |
MonetizationTeamAccount | MonetizationTeamAccount | |
MultipartUpload | MultipartUpload | |
MultipartUploadPart | MultipartUploadPart | |
ProgressHandle | ProgressHandle | A ProgressHandle can only be used to monitor the progress of an operation and cannot be used to cancel or suspend ongoing operations. The OperationType enum field specifies what type of operation this handle is for. The Progress field can be used to get the percentage (0.0 - 1.0) of the progress. The Completed and Failed fields can be used to determine if the operation is complete and whether or not it failed. |
Rating | Rating | A struct representing all of the information available for a Rating. |
Report | Report | Used in conjunction with ModIOUnity.Report() to send a report to the mod.io server for a specific mod. |
Result | Result | Struct returned from ModIO callbacks to inform the caller if the operation succeeded. |
ResultAnd | ResultAnd | Convenience wrapper for essentially a Tuple. |
SearchFilter | SearchFilter | Used to build a filter that is sent with requests for retrieving mods. |
ServerSettings | ServerSettings | Describes the server settings to use for the ModIO Plugin. This can be setup directly from the inspector when editing the config settings file, or you can instantiate and use this at runtime with the Initialize method |
SubscribedMod | SubscribedMod | Represents the ModProfile of a mod the current user has subscribed to. Contains the status and a directory (if installed) and the associated ModProfile. |
SubscribedModStatusExtensions | SubscribedModStatusExtensions | |
Tag | Tag | Represents a Tag that can be assigned to a mod. |
TagCategory | TagCategory | Represents a particular category of tags. |
TermsHash | TermsHash | This is the hash that identifies the TOS. Used to validate the TOS requirement when attempting to authenticate a user. |
TermsOfUse | TermsOfUse | TOS object received from a successful use of ModIOUnity.GetTermsOfUse This is used when attempting to authenticate via a third party. You must retrieve the TOS and input it along with an authentication request. |
TermsOfUseLink | TermsOfUseLink | Represents a url as part of the TOS. The 'required' field can be used to determine whether or not it is a TOS requirement to be displayed to the end user when viewing the TOS text. |
TokenPack | TokenPack | |
UISettings | UISettings | |
UserInstalledMod | UserInstalledMod | Struct used to represent a mod that already exists on the current device. You can view the subscribed users to this mod as well as the directory and modprofile associated to it. |
UserProfile | UserProfile | Represents a particular mod.io user with their username, DownloadReferences for getting their avatar, as well as their language and timezone. |
Wallet | Wallet | A struct representing the user's wallet and current balance. |
AuthenticationServiceProviderExtensions
public static class AuthenticationServiceProviderExtensions
Method
GetProviderName
public static string GetProviderName(this AuthenticationServiceProvider provider)
GetTokenFieldName
public static string GetTokenFieldName(this AuthenticationServiceProvider provider)
BuildSettings
[System.Serializable] public class BuildSettings
Build-specific configuration values. This can be setup directly from the inspector when editing the config settings file, or you can instantiate and use this at runtime with the Initialize method
See Also
ServerSettings
ModIOUnity.InitializeForUser
Field
LogLevel logLevel
LogLevel logLevel
Level to log at.
UserPortal userPortal
UserPortal userPortal = UserPortal.None
Portal the game will be launched through.
UserPortal defaultPortal
UserPortal defaultPortal = UserPortal.None
Default portal.
uint requestCacheLimitKB
uint requestCacheLimitKB
Size limit for the request cache.
int writeSpeedInKbPerSecond
int writeSpeedInKbPerSecond = 0
The speed at which will be maintained when performing write operations
int bytesPerWrite
int bytesPerWrite = 0
The max number of bytes that will be written in one write operation
float writeSpeedReductionThreshold
float writeSpeedReductionThreshold = .75f
The threshold as a percentage of the total budget of one interval, at which write operations will start to slow down.
bool disableWriteSpeedReduction
bool disableWriteSpeedReduction = false
Method
SetDefaultPortal
public void SetDefaultPortal()
CommentDetails
public class CommentDetails
Field
long replyId
long replyId
Id of the parent comment this comment is replying to (can be 0 if the comment is not a reply).
string content
string content
Contents of the comment.
CommentPage
[System.Serializable] public struct CommentPage
A struct containing the ModComments and total number of remaining results that can be acquired with the SearchFilter used in the GetMods request.
See Also
ModIOUnity.GetModComments
ModIOUnityAsync.GetModComments
Field
ModComment CommentObjects
ModComment[] CommentObjects
The mod profiles retrieved from this pagination request
See Also
ModIOUnity.GetModComments
ModIOUnityAsync.GetModComments
long totalSearchResultsFound
long totalSearchResultsFound
the total results that could be found. eg there may be a total of 1,000 comments but this CommentPage may only contain the first 100, depending on the SearchFilter pagination settings.
See Also
SearchFilter
SearchFilter.SetPageIndex
SearchFilter.SetPageSize
ModIOUnity.GetModComments
ModIOUnityAsync.GetModComments
DownloadReference
[System.Serializable] public struct DownloadReference
Used in ModIOUnity.DownloadTexture() to get the Texture. (DownloadReference is serializable with Unity's JsonUtility)
See Also
ModIOUnity.DownloadTexture
ModIOUnityAsync.DownloadTexture
Field
ModId modId
ModId modId
string url
string url
string filename
string filename
Method
IsValid
public bool IsValid()
Check if there is a valid url for this image. You may want to check this before using the ModIOUnity.DownloadTexture method.
See Also
ModIOUnity.DownloadTexture
ModIOUnityAsync.DownloadTexture
Returns
true if the url isn't null
Entitlement
[Serializable] public struct Entitlement
A struct representing all of the information available for an Entitlement.
See Also
ModIOUnity.SyncEntitlements
ModIOUnityAsync.SyncEntitlements
Field
string transactionId
string transactionId
int transactionState
int transactionState
string skuId
string skuId
bool entitlementConsumed
bool entitlementConsumed
InstalledMod
public struct InstalledMod
Struct used to represent a mod that already exists on the current device. You can view the subscribed users to this mod as well as the directory and modprofile associated to it.
See Also
ModIOUnity.GetSystemInstalledMods
ModProfile
Field
List subscribedUsers
List<long> subscribedUsers
The usernames of all the known users on this device that are subscribed to this mod
bool updatePending
bool updatePending
Whether or not the mod has been marked for an update
string directory
string directory
the directory of where this mod is installed
string metadata
string metadata
The metadata for the version of the mod that is currently installed (Not to be mistaken with the metadata located inside of ModProfile.cs)
string version
string version
the version of this installed mod
string changeLog
string changeLog
the change log for this version of the installed mod
DateTime dateAdded
DateTime dateAdded
The date that this version of the mod was submitted to mod.io
ModProfile modProfile
ModProfile modProfile
The profile of this mod, including the summary and name
bool enabled
bool enabled
Whether the mod has been marked as enabled or disabled by the user
See Also
ModIOUnity.EnableMod
ModIOUnity.DisableMod
ModComment
public struct ModComment
Field
long id
long id
Unique id of the comment.
ModId modId
ModId modId
Unique id of the parent mod. This is now deprecated and will be removed in future API versions, please use resource_id instead.
long resourceId
long resourceId
Unique id of the resource.
long submittedBy
long submittedBy
Unique id of the user who posted the comment.
long dateAdded
long dateAdded
Unix timestamp of date comment was posted.
string threadPosition
string threadPosition
Levels of nesting in a comment thread. You should order by this field, to maintain comment grouping. How it works:
- The first comment will have the position '01'.
- The second comment will have the position '02'.
- If someone responds to the second comment the position will be '02.01'.
- A maximum of 3 levels is supported.
long karma
long karma
Karma received for the comment (can be positive or negative).
CommentDetails commentDetails
CommentDetails commentDetails
UserProfile userProfile
UserProfile userProfile
ModDependencies
[Serializable] public struct ModDependencies
A struct representing all of the information available for a Mod's Dependencies.
See Also
ModIOUnity.GetModDependencies
ModIOUnityAsync.GetModDependencies
Field
ModId modId
ModId modId
string modName
string modName
string modNameId
string modNameId
DateTime dateAdded
DateTime dateAdded
int dependencyDepth
int dependencyDepth
DownloadReference logoImage_320x180
DownloadReference logoImage_320x180
DownloadReference logoImage_640x360
DownloadReference logoImage_640x360
DownloadReference logoImage_1280x720
DownloadReference logoImage_1280x720
DownloadReference logoImageOriginal
DownloadReference logoImageOriginal
Modfile modfile
Modfile modfile
ModIOUnity
public static class ModIOUnity
Main interface for the mod.io Unity plugin.
Remarks
Every ModIOUnity method with a callback has an asynchronous alternative in ModIOUnityAsync.
See Also
Method
IsInitialized
public static bool IsInitialized(bool attemptAutoInitializeIfNeeded
Returns
true if the plugin has been initialized.
SetLoggingDelegate
public static void SetLoggingDelegate(LogMessageDelegate loggingDelegate)
Use to send log messages to loggingDelegate instead of Unity.Debug.Log(string).
Parameters
loggingDelegate The delegate for receiving log messages
ModIOUnity.SetLoggingDelegate((LogLevel logLevel, string logMessage) => {
if (logLevel == LogLevel.Error)
Debug.LogError($"mod.io plugin error: {logMessage}");
});
See Also
LogMessageDelegate
LogLevel
InitializeForUser
public static Result InitializeForUser(string userProfileIdentifier, ServerSettings serverSettings, BuildSettings buildSettings, UISettings uiSettings
Use if you have a pre-configured mod.io config ScriptableObject.
Parameters
userProfileIdentifier
serverSettings Data used by the plugin to connect with the mod.io service.
buildSettings Data used by the plugin to interact with the platform.
uiSettings Data used by the plugin's default UI to decide what features to show
ServerSettings serverSettings = new ServerSettings {
serverURL = "https://api.test.mod.io/v1",
gameId = 1234,
gameKey = "1234567890abcdefghijklmnop"
};
See Also
ServerSettings
BuildSettings
Result
FetchUpdates
Shutdown
InitializeForUser
public static Result InitializeForUser(string userProfileIdentifier)
Shutdown
public static void Shutdown(Action shutdownComplete)
Cancels all public operations, frees plugin resources and invokes any pending callbacks with a cancelled result code.
Remarks
Result.IsCancelled() can be used to determine if it was cancelled due to a shutdown operation.
ModIOUnity.Shutdown(() => Debug.Log("Plugin shutdown complete"));
See Also
Ping
public static void Ping(Action<Result> callback)
Pings the server.
Result.Succeeded() will be true if a response was received.
RequestExternalAuthentication
public static void RequestExternalAuthentication(Action<ResultAnd<ExternalAuthenticationToken>> callback)
Listen for an external login attempt. The callback argument contains an that includes the url and code to display to the user. ExternalAuthenticationToken.task will complete once the user enters the code.
Parameters
callback The callback to handle the response, which includes the if the request was successful.
Remarks
The request will time out after 15 minutes. You can cancel it at any time using token.Cancel().
ModIOUnity.RequestExternalAuthentication(async response =>
{
if (!response.result.Succeeded())
{
Debug.Log($"RequestExternalAuthentication failed: {response.result.message}");
return;
}
See Also
Result
ResultAnd
ExternalAuthenticationToken
RequestAuthenticationEmail
public static void RequestAuthenticationEmail(string emailaddress, Action<Result> callback)
Sends an email with a security code to the specified Email Address. The security code is then used to Authenticate the user session using ModIOUnity.SubmitEmailSecurityCode()
Remarks
The callback will return a Result object. If the email is successfully sent Result.Succeeded() will equal true. If you haven't Initialized the plugin then Result.IsInitializationError() will equal true. If the string provided for the emailaddress is not .NET compliant Result.IsAuthenticationError() will equal true.
Parameters
emailaddress the Email Address to send the security code to, eg "JohnDoe@gmail.com"
callback Callback to invoke once the operation is complete
See Also
SubmitEmailSecurityCode
Result
ModIOUnityAsync.RequestAuthenticationEmail
void Example()
{
ModIOUnity.RequestAuthenticationEmail("johndoe@gmail.com", RequestAuthenticationCallback);
}
void RequestAuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Succeeded to send security code");
}
else
{
Debug.Log("Failed to send security code to that email address");
}
}
SubmitEmailSecurityCode
public static void SubmitEmailSecurityCode(string securityCode, Action<Result> callback)
Attempts to Authenticate the current session by submitting a security code received by email from ModIOUnity.RequestAuthenticationEmail()
Remarks
It is intended that this function is used after ModIOUnity.RequestAuthenticationEmail() is performed successfully.
Parameters
securityCode The security code received from an authentication email
callback Callback to invoke once the operation is complete
See Also
RequestAuthenticationEmail
Result
ModIOUnityAsync.SubmitEmailSecurityCode
void Example(string userSecurityCode)
{
ModIOUnity.SubmitEmailSecurityCode(userSecurityCode, SubmitCodeCallback);
}
void SubmitCodeCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("You have successfully authenticated the user");
}
else
{
Debug.Log("Failed to authenticate the user");
}
}
GetTermsOfUse
public static void GetTermsOfUse(Action<ResultAnd<TermsOfUse>> callback)
This retrieves the terms of use text to be shown to the user to accept/deny before authenticating their account via a third party provider, eg steam or google.
Remarks
If the callback succeeds it will also provide a TermsOfUse struct that contains a TermsHash struct which you will need to provide when calling a third party authentication method such as ModIOUnity.AuthenticateUserViaSteam()
Parameters
callback Callback to invoke once the operation is complete containing a
result and a hash code to use for authentication via third party providers.
See Also
TermsOfUse
AuthenticateUserViaDiscord
AuthenticateUserViaGoogle
AuthenticateUserViaGOG
AuthenticateUserViaItch
AuthenticateUserViaOculus
AuthenticateUserViaSteam
AuthenticateUserViaSwitch
AuthenticateUserViaXbox
AuthenticateUserViaPlayStation
ModIOUnityAsync.GetTermsOfUse
void Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
AuthenticateUserViaSteam
public static void AuthenticateUserViaSteam(string steamToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the steam API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
steamToken the user's steam token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse() (Can be null if submitted once before)
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaSteam
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaSteam(steamToken, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaEpic
public static void AuthenticateUserViaEpic(string epicToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the epic API.
Parameters
epicToken the user's epic token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaEpic
AuthenticateUserViaGOG
public static void AuthenticateUserViaGOG(string gogToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the GOG API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
gogToken the user's gog token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaGOG
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaGOG(gogToken, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaPlayStation
public static void AuthenticateUserViaPlayStation(string authCode, string emailAddress, TermsHash? hash, PlayStationEnvironment environment, Action<Result> callback)
Attempts to authenticate a user via the GOG API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
authCode the user's auth code
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
environment the PSN account environment
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaGOG
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaPlaystation(authCode, "johndoe@gmail.com", modIOTermsOfUse.hash, PlayStationEnvironment.np, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaItch
public static void AuthenticateUserViaItch(string itchioToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the Itch.io API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
itchioToken the user's itch token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaItch
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaItch(itchioToken, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaXbox
public static void AuthenticateUserViaXbox(string xboxToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the Xbox API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
xboxToken the user's xbl token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaXbox
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaXbox(xboxToken, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaSwitch
public static void AuthenticateUserViaSwitch(string SwitchNsaId, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the switch API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
SwitchNsaId the user's switch NSA id token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaSwitch
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaSwitch(switchToken, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaDiscord
public static void AuthenticateUserViaDiscord(string discordToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the Discord API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
discordToken the user's discord token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaDiscord
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaDiscord(discordToken, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaGoogle
public static void AuthenticateUserViaGoogle(string token, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the Google API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
token google auth code or id token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaGoogle
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaGoogle(token, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaApple
public static void AuthenticateUserViaApple(string authCode, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the Apple API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
authCode Apple auth code
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaApple
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaApple(authCode, "johndoe@gmail.com", modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaOculus
public static void AuthenticateUserViaOculus(OculusDevice oculusDevice, string nonce, long userId, string oculusToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user via the Oculus API.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
oculusDevice the device your authenticating on
nonce the nonce
oculusToken the user's oculus token
emailAddress the user's email address (Can be null)
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
userId
See Also
GetTermsOfUse
ModIOUnityAsync.AuthenticateUserViaOculus
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaOculus(oculusDevice.Quest,
nonce,
userId,
oculusToken,
"johndoe@gmail.com",
modIOTermsOfUse.hash, AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaOpenId
public static void AuthenticateUserViaOpenId(string idToken, string emailAddress, TermsHash? hash, Action<Result> callback)
Attempts to authenticate a user on behalf of an OpenID identity provider. To use this method of authentication, you must configure the OpenID config in your games authentication admin page. NOTE: The ability to authenticate players using your identity provider is a feature for advanced partners only. If you are interested in becoming an advanced partner, please contact us.
Remarks
You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.
Parameters
idToken the user's id token
emailAddress the user's email address
hash the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
callback Callback to be invoked when the operation completes
See Also
// First we get the Terms of Use to display to the user and cache the hash
void GetTermsOfUse_Example()
{
ModIOUnity.GetTermsOfUse(GetTermsOfUseCallback);
}
void GetTermsOfUseCallback(ResultAnd<TermsOfUse> response)
{
if (response.result.Succeeded())
{
Debug.Log("Successfully retrieved the terms of use: " + response.value.termsOfUse);
// Cache the terms of use (which has the hash for when we attempt to authenticate)
modIOTermsOfUse = response.value;
}
else
{
Debug.Log("Failed to retrieve the terms of use");
}
}
// Once we have the Terms of Use and hash we can attempt to authenticate
void Authenticate_Example()
{
ModIOUnity.AuthenticateUserViaOpenId(idToken,
"johndoe@gmail.com",
modIOTermsOfUse.hash,
AuthenticationCallback);
}
void AuthenticationCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
IsAuthenticated
public static void IsAuthenticated(Action<Result> callback)
Informs you if the current user session is authenticated or not.
Parameters
callback
See Also
Result
ModIOUnityAsync.IsAuthenticated
void Example()
{
ModIOUnity.IsAuthenticated(IsAuthenticatedCallback);
}
void IsAuthenticatedCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("current session is authenticated");
}
else
{
Debug.Log("current session is not authenticated");
}
}
LogOutCurrentUser
public static Result LogOutCurrentUser()
De-authenticates the current Mod.io user for the current session and clears all user-specific data stored on the current device. Installed mods that do not have other local users subscribed will be uninstalled if ModIOUnity.EnableModManagement() has been used to enable the mod management system. (If ModManagement is enabled).
Remarks
If you dont want to erase a user be sure to use ModIOUnity.Shutdown() instead. If you re-initialize the plugin after a shutdown the user will still be authenticated.
See Also
EnableModManagement(ModIO.ModManagementEventDelegate)
Result
//static async void Example()
{
Result result = await ModIOUnity.LogOutCurrentUser();
if(result.Succeeded())
{
Debug.Log("The current user has been logged and their local data removed");
}
else
{
Debug.Log("Failed to log out the current user");
}
}
GetTagCategories
public static void GetTagCategories(Action<ResultAnd<TagCategory[]>> callback)
Gets the existing tags for the current game Id that can be used when searching/filtering mods.
Remarks
Tags come in category groups, eg "Color" could be the name of the category and the tags themselves could be Green
Parameters
callback the callback with the result and tags retrieved
See Also
SearchFilter
TagCategory
Result
ModIOUnityAsync.GetTagCategories
void Example()
{
ModIOUnity.GetTagCategories(GetTagsCallback);
}
void GetTagsCallback(ResultAnd<TagCategory[]> response)
{
if (response.result.Succeeded())
{
foreach(TagCategory category in response.value)
{
foreach(Tag tag in category.tags)
{
Debug.Log(tag.name + " tag is in the " + category.name + "category");
}
}
}
else
{
Debug.Log("failed to get game tags");
}
}
GetTagLocalized
public static string GetTagLocalized(string tag)
Ensure you have called ModIOUnityAsync.FetchUpdates or ModIOUnityAsync.GetTagCategories before using this method.
Note:
All plugin functionality requires English tags. Localized tags can displayed to players.
Returns
tag in the plugin's currently configured language if it exists, otherwise tag.
See Also
GetTagLocalized
public static string GetTagLocalized(string tag, string languageCode)
Ensure you have called ModIOUnityAsync.FetchUpdates or ModIOUnityAsync.GetTagCategories before using this method.
Note:
All plugin functionality requires English tags. Localized tags can displayed to players.
Returns
tag in the provided languageCode if it exists, otherwise tag.
GetMods
public static void GetMods(SearchFilter filter, Action<ResultAnd<ModPage>> callback)
Uses a SearchFilter to retrieve a specific Mod Page and returns the ModProfiles and total number of mods based on the Search Filter.
Remarks
A ModPage contains a group of mods based on the pagination filters in SearchFilter. eg, if you use SearchFilter.SetPageIndex(0) and SearchFilter.SetPageSize(100) then ModPage.mods will contain mods from 1 to 100. But if you set SearchFilter.SetPageIndex(1) then it will have mods from 101 to 200, if that many exist. (note that 100 is the maximum page size).
Parameters
filter The filter to apply when searching through mods (also contains
pagination parameters)
callback callback invoked with the Result and ModPage
See Also
SearchFilter
ModPage
Result
ModIOUnityAsync.GetMods
void Example()
{
SearchFilter filter = new SearchFilter();
filter.SetPageIndex(0);
filter.SetPageSize(10);
ModIOUnity.GetMods(filter, GetModsCallback);
}
void GetModsCallback(Result result, ModPage modPage)
{
if (result.Succeeded())
{
Debug.Log("ModPage has " + modPage.modProfiles.Length + " mods");
}
else
{
Debug.Log("failed to get mods");
}
}
GetMod
public static void GetMod(ModId modId, Action<ResultAnd<ModProfile>> callback)
Requests a single ModProfile from the mod.io server by its ModId.
Remarks
If there is a specific mod that you want to retrieve from the mod.io database you can use this method to get it.
Parameters
modId the ModId of the ModProfile to get
callback callback with the Result and ModProfile
See Also
ModId
ModProfile
Result
ModIOUnityAsync.GetMod
void Example()
{
ModId modId = new ModId(1234);
ModIOUnity.GetMod(modId, GetModCallback);
}
void GetModCallback(ResultAnd<ModProfile> response)
{
if (response.result.Succeeded())
{
Debug.Log("retrieved mod " + response.value.name);
}
else
{
Debug.Log("failed to get mod");
}
}
GetModSkipCache
public static void GetModSkipCache(ModId modId, Action<ResultAnd<ModProfile>> callback)
GetModComments
public static void GetModComments(ModId modId, SearchFilter filter, Action<ResultAnd<CommentPage>> callback)
Get all comments posted in the mods profile. Successful request will return an array of Comment Objects. We recommended reading the filtering documentation to return only the records you want.
Parameters
filter The filter to apply when searching through comments (can only apply
pagination parameters, Eg. page size and page index)
callback callback invoked with the Result and CommentPage
See Also
CommentPage
ModComment
SearchFilter
ModId
Result
ResultAnd
ModIOUnityAsync.GetModComments
GetModDependencies
public static void GetModDependencies(ModId modId, Action<ResultAnd<ModDependencies[]>> callback)
Retrieves a list of ModDependenciesObjects that represent mods that depend on a mod.
Remarks
This function returns only immediate mod dependencies, meaning that if you need the dependencies for the dependent mods, you will have to make multiple calls and watch for circular dependencies.
Parameters
modId the ModId of the mod to get dependencies
callback callback with the Result and an array of ModDependenciesObjects
See Also
ModId
Result
ResultAnd
ModDependenciesObject
ModIOUnityAsync.GetModDependencies
void Example()
{
ModId modId = new ModId(1234);
ModIOUnity.GetModDependencies(modId, GetModCallback);
}
void GetModCallback(ResultAnd<ModDependenciesObject[]> response)
{
if (response.result.Succeeded())
{
ModDependenciesObject[] modDependenciesObjects = response.value;
Debug.Log("retrieved mods dependencies");
}
else
{
Debug.Log("failed to get mod dependencies");
}
}
GetCurrentUserRatings
public static void GetCurrentUserRatings(Action<ResultAnd<Rating[]>> callback)
Get all mod rating's submitted by the authenticated user. Successful request will return an array of Rating Objects.
Parameters
callback callback with the Result and an array of RatingObject
See Also
void Example()
{
ModIOUnity.GetCurrentUserRatings(GetCurrentUserRatingsCallback);
}
void GetCurrentUserRatingsCallback(ResultAnd<Rating[]> response)
{
if (response.result.Succeeded())
{
foreach(var ratingObject in response.value)
{
Debug.Log($"retrieved rating '{ratingObject.rating}' for {ratingObject.modId}");
}
}
else
{
Debug.Log("failed to get ratings");
}
}
GetCurrentUserRatingFor
public static void GetCurrentUserRatingFor(ModId modId, Action<ResultAnd<ModRating>> callback)
Gets the rating that the current user has given for a specified mod. You must have an authenticated session for this to be successful.
Remarks
Note that the rating can be 'None'
Parameters
modId the id of the mod to check for a rating
callback callback with the result and rating of the specified mod
See Also
void Example()
{
ModId modId = new ModId(1234);
ModIOUnity.GetCurrentUserRatingFor(modId, GetRatingCallback);
}
void GetRatingCallback(ResultAnd<ModRating> response)
{
if (response.result.Succeeded())
{
Debug.Log($"retrieved rating: {response.value}");
}
else
{
Debug.Log("failed to get rating");
}
}
RateMod
public static void RateMod(ModId modId, ModRating rating, Action<Result> callback)
Used to submit a rating for a specified mod.
Remarks
This can be used to change/overwrite previous ratings of the current user.
Parameters
modId the m=ModId of the mod being rated
rating the rating to give the mod. Allowed values include ModRating.Positive, ModRating.Negative, ModRating.None
callback callback with the result of the request
See Also
ModRating
Result
ModId
ModIOUnityAsync.RateMod
ModProfile mod;
void Example()
{
ModIOUnity.RateMod(mod.id, ModRating.Positive, RateModCallback);
}
void RateModCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully rated mod");
}
else
{
Debug.Log("Failed to rate mod");
}
}
SubscribeToMod
public static void SubscribeToMod(ModId modId, Action<Result> callback)
Adds the specified mod to the current user's subscriptions.
Remarks
If mod management has been enabled via ModIOUnity.EnableModManagement() then the mod will be downloaded and installed.
Parameters
modId ModId of the mod you want to subscribe to
callback callback with the result of the request
See Also
Result
ModId
EnableModManagement(ModIO.ModManagementEventDelegate)
GetCurrentModManagementOperation
ModIOUnityAsync.SubscribeToMod
ModProfile mod;
void Example()
{
ModIOUnity.SubscribeToMod(mod.id, SubscribeCallback);
}
void SubscribeCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully subscribed to mod");
}
else
{
Debug.Log("Failed to subscribe to mod");
}
}
UnsubscribeFromMod
public static void UnsubscribeFromMod(ModId modId, Action<Result> callback)
Removes the specified mod from the current user's subscriptions.
Remarks
If mod management has been enabled via ModIOUnity.EnableModManagement() then the mod will be uninstalled at the next opportunity.
Parameters
modId ModId of the mod you want to unsubscribe from
callback callback with the result of the request
See Also
Result
ModId
EnableModManagement(ModIO.ModManagementEventDelegate)
GetCurrentModManagementOperation
ModIOUnityAsync.UnsubscribeFromMod
ModProfile mod;
void Example()
{
ModIOUnity.UnsubscribeFromMod(mod.id, UnsubscribeCallback);
}
void UnsubscribeCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully unsubscribed from mod");
}
else
{
Debug.Log("Failed to unsubscribe from mod");
}
}
GetSubscribedMods
public static SubscribedMod[] GetSubscribedMods(out Result result)
Retrieves all of the subscribed mods for the current user.
Remarks
Note that these are not installed mods only mods the user has opted as 'subscribed'. Also, ensure you have called ModIOUnity.FetchUpdates() at least once during this session in order to have an accurate collection of the user's subscriptions.
Parameters
result an out parameter for whether or not the method succeeded
See Also
Result
SubscribedMod
FetchUpdates
Returns
an array of the user's subscribed mods
void Example()
{
SubscribedMod[] mods = ModIOUnity.GetSubscribedMods(out Result result);
if (result.Succeeded())
{
Debug.Log("use has " + mods.Length + " subscribed mods");
}
else
{
Debug.Log("failed to get user mods");
}
}
GetCurrentUser
public static void GetCurrentUser(Action<ResultAnd<UserProfile>> callback, bool allowOfflineUser
Gets the current user's UserProfile struct. Containing their mod.io username, user id, language, timezone and download references for their avatar.
Remarks
This requires the current session to have an authenticated user, otherwise Result.IsAuthenticationError() from the Result will equal true.
Parameters
callback callback with the Result and the UserProfile
allowOfflineUser True if we allow the last saved user data if the server cannot be reached. Note that Result will still be a NetworkError
See Also
Result
UserProfile
IsAuthenticated
ModIOUnityAsync.GetCurrentUser
void Example()
{
ModIOUnity.GetCurrentUser(GetUserCallback);
}
void GetUserCallback(ResultAnd<UserProfile> response)
{
if (response.result.Succeeded())
{
Debug.Log("Got user: " + response.value.username);
}
else
{
Debug.Log("failed to get user");
}
}
MuteUser
public static void MuteUser(long userId, Action<Result> callback)
Mutes a user which effectively hides any content from that specified user
Remarks
The userId can be found from the UserProfile. Such as ModProfile.creator.userId
Parameters
userId The id of the user to be muted
callback callback with the Result of the request
See Also
UnmuteUser
public static void UnmuteUser(long userId, Action<Result> callback)
Un-mutes a user which effectively reveals previously hidden content from that user
Remarks
The userId can be found from the UserProfile. Such as ModProfile.creator.userId
Parameters
userId The id of the user to be muted
callback callback with the Result of the request
See Also
GetMutedUsers
public static void GetMutedUsers(Action<ResultAnd<UserProfile[]>> callback)
Gets an array of all the muted users that the current authenticated user has muted.
Remarks
This has a cap of 1,000 users. It will not return more then that.
Parameters
callback callback with the Result of the request
See Also
FetchUpdates
public static void FetchUpdates(Action<Result> callback)
This retrieves the user's ratings and subscriptions from the mod.io server and synchronises it with our local instance of the user's data. If mod management has been enabled via ModIOUnity.EnableModManagement() then it may begin to install/uninstall mods. It's recommended you use this method after initializing the plugin and after successfully authenticating the user.
Remarks
This requires the current session to have an authenticated user, otherwise Result.IsAuthenticationError() from the Result will equal true.
Parameters
callback callback with the Result of the operation
See Also
Result
EnableModManagement(ModIO.ModManagementEventDelegate)
IsAuthenticated
RequestAuthenticationEmail
SubmitEmailSecurityCode
AuthenticateUserViaDiscord
AuthenticateUserViaGoogle
AuthenticateUserViaGOG
AuthenticateUserViaItch
AuthenticateUserViaOculus
AuthenticateUserViaSteam
AuthenticateUserViaSwitch
AuthenticateUserViaXbox
ModIOUnityAsync.FetchUpdates
void Example()
{
ModIOUnity.FetchUpdates(FetchUpdatesCallback);
}
void FetchUpdatesCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("updated user subscriptions");
}
else
{
Debug.Log("failed to get user subscriptions");
}
}
EnableModManagement
public static Result EnableModManagement( ModManagementEventDelegate modManagementEventDelegate)
Enables the mod management system. When enabled it will automatically download, install, update and delete mods according to the authenticated user's subscriptions.
Remarks
This requires the current session to have an authenticated user, otherwise Result.IsAuthenticationError() from the Result will equal true.
Parameters
modManagementEventDelegate A delegate that gets called everytime the ModManagement system runs an event (can be null)
Returns
A Result for whether or not mod management was enabled
See Also
Result
DisableModManagement
IsAuthenticated
void Example()
{
Result result = ModIOUnity.EnableModManagement(ModManagementDelegate);
}
void ModManagementDelegate(ModManagementEventType eventType, ModId modId)
{
Debug.Log("a mod management event of type " + eventType.ToString() + " has been invoked");
}
DisableModManagement
public static Result DisableModManagement()
Disables the mod management system and cancels any ongoing jobs for downloading or installing mods.
void Example()
{
Result result = ModIOUnity.DisableModManagement();
if (result.Succeeded())
{
Debug.Log("disabled mod management");
}
else
{
Debug.Log("failed to disable mod management");
}
}
GetCurrentModManagementOperation
public static ProgressHandle GetCurrentModManagementOperation()
Returns a ProgressHandle with information on the current mod management operation.
Returns
Optional ProgressHandle object containing information regarding the progress of the operation. Null if no operation is running
See Also
ProgressHandle
EnableModManagement
void Example()
{
ProgressHandle handle = ModIOUnity.GetCurrentModManagementOperation();
if (handle != null)
{
Debug.Log("current mod management operation is " + handle.OperationType.ToString());
}
else
{
Debug.Log("no current mod management operation");
}
}
GetSystemInstalledMods
public static InstalledMod[] GetSystemInstalledMods(out Result result)
Gets an array of mods that are installed on the current device.
Remarks
Note that these will not be subscribed by the current user. If you wish to get all of the current user's installed mods use ModIOUnity.GetSubscribedMods() and check the SubscribedMod.status equals SubscribedModStatus.Installed.
Parameters
result an out Result to inform whether or not it was able to get installed mods
See Also
InstalledMod
GetSubscribedMods
Returns
an array of InstalledMod for each existing mod installed on the current device (and not subscribed by the current user)
void Example()
{
InstalledMod[] mods = ModIOUnity.GetSystemInstalledMods(out Result result);
if (result.Succeeded())
{
Debug.Log("found " + mods.Length.ToString() + " mods installed");
}
else
{
Debug.Log("failed to get installed mods");
}
}
GetInstalledModsForUser
public static UserInstalledMod[] GetInstalledModsForUser(out Result result, bool includeDisabledMods
Gets an array of mods that are installed for the current user.
Parameters
result an out Result to inform whether or not it was able to get installed mods
includeDisabledMods optional parameter. When true it will include mods that have been marked as disabled via the DisableMod method
See Also
UserInstalledMod
GetSubscribedMods
ModIOUnity.DisableMod
ModIOUnity.EnableMod
Returns
an array of InstalledModUser for each existing mod installed for the user
void Example()
{
InstalledModUser[] mods = ModIOUnity.GetSystemInstalledModsUser(out Result result);
if (result.Succeeded())
{
Debug.Log("found " + mods.Length.ToString() + " mods installed");
}
else
{
Debug.Log("failed to get installed mods");
}
}
ForceUninstallMod
public static Result ForceUninstallMod(ModId modId)
This informs the mod management system that this mod should be uninstalled if not subscribed by the current user. (such as a mod installed by a different user not currently active).
Remarks
Normally if you wish to uninstall a mod you should unsubscribe and use ModIOUnity.EnableModManagement() and the process will be handled automatically. However, if you want to uninstall a mod that is subscribed to a different user session this method will mark the mod to be uninstalled to free up disk space. Alternatively you can use ModIOUnity.RemoveUserData() to remove a user from the local registry. If no other users are subscribed to the same mod it will be uninstalled automatically.
Parameters
modId The ModId of the mod to uninstall
See Also
Result
SubscribeToMod
UnsubscribeFromMod
EnableModManagement
LogOutCurrentUser
ModProfile mod;
void Example()
{
Result result = ModIOUnity.ForceUninstallMod(mod.id);
if (result.Succeeded())
{
Debug.Log("mod marked for uninstall");
}
else
{
Debug.Log("failed to mark mod for uninstall");
}
}
RetryDownload
public static Result RetryDownload(ModId modId)
Clear the "download failed" state on a mod and allow DownloadManager to try downloading it again
Parameters
modId
Returns
IsModManagementBusy
public static bool IsModManagementBusy()
Checks if the automatic management process is currently awake and performing a mod management operation, such as installing, downloading, uninstalling, updating.
Returns
True if automatic mod management is currently performing an operation.
See Also
EnableModManagement
DisableModManagement
GetCurrentModManagementOperation
void Example()
{
if (ModIOUnity.IsModManagementBusy())
{
Debug.Log("mod management is busy");
}
else
{
Debug.Log("mod management is not busy");
}
}
EnableMod
public static bool EnableMod(ModId modId)
DisableMod
public static bool DisableMod(ModId modId)
AddDependenciesToMod
public static void AddDependenciesToMod(ModId modId, ICollection<ModId> dependencies, Action<Result> callback)
Adds the specified mods as dependencies to an existing mod.
Remarks
If the dependencies already exist they will be ignored and the result will return success
Parameters
modId ModId of the mod you want to add dependencies to
dependencies The ModIds that you want to add (max 5 at a time)
callback callback with the result of the request
See Also
Result
ModId
ModIOUnity.RemoveDependenciesFromMod
ModIOUnityAsync.RemoveDependenciesFromMod
ModIOUnityAsync.AddDependenciesToMod
void Example()
{
var dependencies = new List<ModId>
{
(ModId)1001,
(ModId)1002,
(ModId)1003
};
ModIOUnity.AddDependenciesToMod(mod.id, dependencies, AddDependenciesCallback);
}
void AddDependenciesCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully added dependencies to mod");
}
else
{
Debug.Log("Failed to add dependencies to mod");
}
}
RemoveDependenciesFromMod
public static void RemoveDependenciesFromMod(ModId modId, ICollection<ModId> dependencies, Action<Result> callback)
Removes the specified mods as dependencies for another existing mod.
Remarks
If the dependencies dont exist they will be ignored and the result will return success
Parameters
modId ModId of the mod you want to remove dependencies from
dependencies The ModIds that you want to remove (max 5 at a time)
callback callback with the result of the request
See Also
Result
ModId
ModIOUnity.AddDependenciesToMod
ModIOUnityAsync.RemoveDependenciesFromMod
ModIOUnityAsync.AddDependenciesToMod
void Example()
{
var dependencies = new List<ModId>
{
(ModId)1001,
(ModId)1002,
(ModId)1003
};
ModIOUnity.RemoveDependenciesFromMod(mod.id, dependencies, RemoveDependenciesCallback);
}
void RemoveDependenciesCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successfully removed dependencies from mod");
}
else
{
Debug.Log("Failed to removed dependencies from mod");
}
}
DownloadNow
public static void DownloadNow(ModId modId, Action<Result> callback)
Stops any current download and starts downloading the selected mod.
Parameters
modId ModId of the mod you want to remove dependencies from
callback callback with the result of the request
See Also
Result
ModId
ModIOUnityAsync.DownloadNow
ModId modId;
void Example()
{
ModIOUnity.DownloadNow(modId, callback);
}
void RemoveDependenciesCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
GetModKvpMetadata
public static void GetModKvpMetadata(long modId, Action<ResultAnd<Dictionary<string, string>>> callback)
Get all metadata stored by the game developer for this mod as searchable key value pairs. Successful request will return an array of Metadata KVP Objects.
See Also
MetadataKvpObject
ModIOUnity.GetModKvpMetadata
ModIOUnityAsync.AddModKvpMetadata
ModIOUnityAsync.DeleteModKvpMetadata
long modId;
void Example()
{
ModIOUnityAsync.GetModKvpMetadata(modId, (r)=>
{
if (r.result.Succeeded())
{
Debug.Log("Successfully received metadata for modId");
foreach(var kvp in r.value)
{
Debug.Log($"Key: {kvp.key}, Value: {kvp.value}");
}
}
else
{
Debug.Log("Failed to get metadata for modId.");
}
});
}
AddModKvpMetadata
public static void AddModKvpMetadata(long modId, Dictionary<string, string> metadata, Action<Result> callback)
Add metadata for this mod as searchable key value pairs. Metadata is useful to define how a mod works, or other information you need to display and manage the mod. Successful request will return Message Object. For example: A mod might change gravity and the rate of fire of weapons, you could define these properties as key value pairs. We recommend the mod upload tool you create defines and submits metadata behind the scenes, because if these settings affect gameplay, invalid information may cause problems.
Metadata can also be stored as metadata_blob in the Mod Object.
See Also
MetadataKvpObject
ModIOUnity.AddModKvpMetadata
ModIOUnityAsync.GetModKvpMetadata
ModIOUnityAsync.DeleteModKvpMetadata
long modId;
Dictionary<string, string> metadata;
void Example()
{
Result result = await ModIOUnityAsync.AddModKvpMetadata(modId, metadata, (result)=>
{
if (result.Succeeded())
{
Debug.Log("Successfully added metadata.");
}
else
{
Debug.Log("Failed to add metadata.");
}
});
}
DeleteModKvpMetadata
public static void DeleteModKvpMetadata(long modId, Dictionary<string, string> metadata, Action<Result> callback)
Delete key value pairs metadata defined for this mod. Successful request will return 204 No Content.
See Also
MetadataKvpObject
ModIOUnity.DeleteModKvpMetadata
ModIOUnityAsync.AddModKvpMetadata
ModIOUnityAsync.GetModKvpMetadata
long modId;
Dictionary<string, string> metadata;
void Example()
{
ModIOUnityAsync.DeleteModKvpMetadata(modId, metadata, (result)=>
{
if (result.Succeeded())
{
Debug.Log("Successfully deleted metadata");
}
else
{
Debug.Log("Failed to delete metadata.");
}
});
}
GenerateCreationToken
public static CreationToken GenerateCreationToken()
Gets a token that can be used to create a new mod profile on the mod.io server.
Returns
a CreationToken used in ModIOUnity.CreateModProfile()
See Also
CreationToken
ModProfileDetails
Result
ModId
CreateModProfile
EditModProfile
void Example()
{
CreationToken token = ModIOUnity.GenerateCreationToken();
}