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();
}
CreateModProfile
public static void CreateModProfile(CreationToken token, ModProfileDetails modProfileDetails, Action<ResultAnd<ModId>> callback)
Creates a new mod profile on the mod.io server based on the details provided from the ModProfileDetails object provided. Note that you must have a logo, name and summary assigned in ModProfileDetails in order for this to work.
Remarks
Note that this will create a new profile on the server and can be viewed online through a browser.
Parameters
token
the token allowing a new unique profile to be created from ModIOUnity.GenerateCreationToken()
modProfileDetails
the mod profile details to apply to the mod profile being created
callback
a callback with the Result of the operation and the ModId of the newly created mod profile (if successful)
See Also
GenerateCreationToken
CreationToken
ModProfileDetails
Result
ModId
ModIOUnityAsync.CreateModProfile
ModId newMod;
Texture2D logo;
CreationToken token;
void Example()
{
token = ModIOUnity.GenerateCreationToken();
ModProfileDetails profile = new ModProfileDetails();
profile.name = "mod name";
profile.summary = "a brief summary about this mod being submitted"
profile.logo = logo;
ModIOUnity.CreateModProfile(token, profile, CreateProfileCallback);
}
void CreateProfileCallback(ResultAnd<ModId> response)
{
if (response.result.Succeeded())
{
newMod = response.value;
Debug.Log("created new mod profile with id " + response.value.ToString());
}
else
{
Debug.Log("failed to create new mod profile");
}
}
EditModProfile
public static void EditModProfile(ModProfileDetails modProfile, Action<Result> callback)
This is used to edit or change data (except images) in an existing mod profile on the mod.io server. If you want to add or edit images, use UploadModMedia.
Remarks
You need to assign the ModId of the mod you want to edit inside of the ModProfileDetails object included in the parameters
Parameters
modProfile
the mod profile details to apply to the mod profile being created
callback
a callback with the Result of the operation and the ModId of the newly created mod profile (if successful)
See Also
ModProfileDetails
Result
ModIOUnityAsync.EditModProfile
ModId modId;
void Example()
{
ModProfileDetails profile = new ModProfileDetails();
profile.modId = modId;
profile.summary = "a new brief summary about this mod being edited";
ModIOUnity.EditModProfile(profile, EditProfileCallback);
}
void EditProfileCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("edited mod profile");
}
else
{
Debug.Log("failed to edit mod profile");
}
}
GetCurrentUploadHandle
public static ProgressHandle GetCurrentUploadHandle()
This will return null if no upload operation is currently being performed.
Remarks
Uploads are not handled by the mod management system, these are handled separately.
Returns
A ProgressHandle informing the upload state and progress. Null if no upload operation is running.
See Also
AddModfile
ArchiveModProfile
void Example()
{
ProgressHandle handle = ModIOUnity.GetCurrentUploadHandle();
if (handle != null)
{
Debug.Log("Current upload progress is: " + handle.Progress.ToString());
}
}
UploadModfile
public static void UploadModfile(ModfileDetails modfile, Action<Result> callback)
Used to upload a mod file to a mod profile on the mod.io server. A mod file is the actual archive of a mod. This method can be used to update a mod to a newer version (you can include changelog information in ModfileDetails).
Remarks
If you want to upload images such as a new logo or gallery images, you can use UploadModMedia instead.
Parameters
modfile
the mod file and details to upload
callback
callback with the Result of the upload when the operation finishes
See Also
Result
ModfileDetails
ArchiveModProfile
GetCurrentUploadHandle
ModIOUnityAsync.AddModfile
UploadModMedia
ModId modId;
void Example()
{
ModfileDetails modfile = new ModfileDetails();
modfile.modId = modId;
modfile.directory = "files/mods/mod_123";
ModIOUnity.UploadModfile(modfile, UploadModCallback);
}
void UploadModCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("uploaded mod file");
}
else
{
Debug.Log("failed to upload mod file");
}
}
UploadModMedia
public static void UploadModMedia(ModProfileDetails modProfileDetails, Action<Result> callback)
This is used to update the logo of a mod or the gallery images. This works very similar to EditModProfile except it only affects the images.
Parameters
modProfileDetails
this holds the reference to the images you wish to upload
callback
a callback with the Result of the operation
See Also
ModProfileDetails
Result
EditModProfile
ModIOUnityAsync.UploadModMedia
ModId modId;
Texture2D newTexture;
void Example()
{
ModProfileDetails profile = new ModProfileDetails();
profile.modId = modId;
profile.logo = newTexture;
ModIOUnity.UploadModMedia(profile, UploadProfileCallback);
}
void UploadProfileCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("uploaded new mod logo");
}
else
{
Debug.Log("failed to uploaded mod logo");
}
}
ReorderModMedia
public static void ReorderModMedia(ModId modId, string[] orderedFilenames, Action<ResultAnd<ModProfile>> callback)
Reorder a mod's gallery images. orderedFilenames
must represent every entry in (or any of the size-variant arrays) or the operation will fail.
The provided callback
is invoked with the updated ModProfile
.
DeleteModMedia
public static void DeleteModMedia(ModId modId, string[] filenames, Action<ResultAnd<ModProfile>> callback)
Delete gallery images from a mod. Filenames can be sourced from (or any of the size-variant arrays).
The provided callback
is invoked with the updated ModProfile
.
ArchiveModProfile
public static void ArchiveModProfile(ModId modId, Action<Result> callback)
Removes a mod from being visible on the mod.io server.
Remarks
If you want to delete a mod permanently you can do so from a web browser.
Parameters
modId
the id of the mod to delete
callback
callback with the result of the operation
See Also
Result
CreateModProfile
EditModProfile
ModIOUnityAsync.ArchiveModProfile
ModId modId;
void Example()
{
ModIOUnity.ArchiveModProfile(modId, ArchiveModCallback);
}
void ArchiveModCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("archived mod profile");
}
else
{
Debug.Log("failed to archive mod profile");
}
}
GetCurrentUserCreations
public static void GetCurrentUserCreations(SearchFilter filter, Action<ResultAnd<ModPage>> callback)
Get all mods the authenticated user added or is a team member of. Successful request will return an array of Mod Objects. We recommended reading the filtering documentation to return only the records you want.
AddTags
public static void AddTags(ModId modId, string[] tags, Action<Result> callback)
Adds the provided tags to the specified mod id. In order for this to work the authenticated user must have permission to edit the specified mod. Only existing tags as part of the game Id will be added.
Parameters
modId
Id of the mod to add tags to
tags
array of tags to be added
callback
callback with the result of the operation
See Also
Result
DeleteTags
ModIOUnityAsync.AddTags
ModId modId;
string[] tags;
void Example()
{
ModIOUnity.AddTags(modId, tags, AddTagsCallback);
}
void AddTagsCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("added tags");
}
else
{
Debug.Log("failed to add tags");
}
}
AddModComment
public static void AddModComment(ModId modId, CommentDetails commentDetails, Action<ResultAnd<ModComment>> callback)
Adds a comment to a mod profile. Successfully adding a comment returns the Mod Comment object back.
Remarks
Keep in mind you can use mentions in the comment content, such as "Hello there, @@<john-doe>"
Parameters
modId
Id of the mod to add the comment to
commentDetails
the new comment to be added
callback
callback with the result of the operation
See Also
Result
ResultAnd
ModComment
CommentDetails
GetModComments
DeleteModComment
EditModComment
ModIOUnityAsync.AddModComment
ModId modId;
void Example()
{
CommentDetails comment = new CommentDetails(0, "Hello world!");
ModIOUnity.AddModComment(modId, comment, AddCommentCallback);
}
void AddCommentCallback(ResultAnd<ModComment> response)
{
if (response.result.Succeeded())
{
Debug.Log("added comment");
}
else
{
Debug.Log("failed to add comment");
}
}
DeleteModComment
public static void DeleteModComment(ModId modId, long commentId, Action<Result> callback)
Delete a comment from a mod profile. Successful request will return 204 No Content and fire a MOD_COMMENT_DELETED event.
Parameters
modId
Id of the mod to add the comment to
commentId
The id for the comment to be removed
callback
callback with the result of the operation
See Also
Result
ModComment
CommentDetails
DeleteModComment
EditModComment
ModIOUnityAsync.DeleteModComment
private ModId modId;
private long commentId;
void Example()
{
ModIOUnity.DeleteModComment(modId, commentId, DeleteCommentCallback);
}
void DeleteCommentCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("deleted comment");
}
else
{
Debug.Log("failed to delete comment");
}
}
UpdateModComment
public static void UpdateModComment(ModId modId, string content, long commentId, Action<ResultAnd<ModComment>> callback)
Update a comment for the corresponding mod. Successful request will return the updated Comment Object.
Parameters
modId
Id of the mod the comment is on
content
Updated contents of the comment.
commentId
The id for the comment you wish to edit
callback
callback with the result of the operation
See Also
ResultAnd
ModComment
ModIOUnityAsync.UpdateModComment
private string content = "This is a Comment";
long commentId = 12345;
ModId modId = (ModId)1234;
void UpdateMod()
{
ModIOUnity.UpdateModComment(modId, content, commentId, UpdateCallback);
}
void UpdateCallback(ResultAnd<ModComment> resultAnd)
{
if(resultAnd.result.Succeeded())
{
Debug.Log("Successfully Updated Comment!");
}
else
{
Debug.Log("Failed to Update Comment!");
}
}
DeleteTags
public static void DeleteTags(ModId modId, string[] tags, Action<Result> callback)
Deletes the specified tags from the mod. In order for this to work the authenticated user must have permission to edit the specified mod.
Parameters
modId
the id of the mod for deleting tags
tags
array of tags to be deleted
callback
callback with the result of the operation
See Also
Result
AddTags
ModIOUnityAsync.DeleteTags
ModId modId;
string[] tags;
void Example()
{
ModIOUnity.DeleteTags(modId, tags, DeleteTagsCallback);
}
void DeleteTagsCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("deleted tags");
}
else
{
Debug.Log("failed to delete tags");
}
}
GetMultipartUploadSessions
public static void GetMultipartUploadSessions(ModId modId, SearchFilter filter, Action<ResultAnd<PaginatedResponse<MultipartUpload>>> callback)
Get all upload sessions belonging to the authenticated user for the corresponding mod. Successful request will return an array of Multipart Upload Part Objects. We recommended reading the filtering documentation to return only the records you want. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
filter
The filter to apply when searching through comments (can only apply
pagination parameters, Eg. page size and page index)
callback
a callback with the Result of the operation
See Also
SearchFilter
ModIOUnityAsync.UploadModfile
ModIOUnityAsync.GetMultipartUploadSessions
ModId modId;
SearchFilter filter;
private void Example()
{
ModIOUnity.GetMultipartUploadSessions(modId, filter, Callback);
}
void Callback(ResultAnd<MultipartUploadSessionsObject> response)
{
if (response.result.Succeeded())
{
Debug.Log("Received Upload Sessions");
}
else
{
Debug.Log("Failed to get Upload Sessions");
}
}
GetMultipartUploadParts
public static void GetMultipartUploadParts(ModId modId, string uploadId, SearchFilter filter, Action<ResultAnd<PaginatedResponse<MultipartUploadPart>>> callback)
Get all uploaded parts for a corresponding upload session. Successful request will return an array of Multipart Upload Part Objects.We recommended reading the filtering documentation to return only the records you want. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
filter
The filter to apply when searching through comments (can only apply
pagination parameters, Eg. page size and page index)
callback
a callback with the Result of the operation
See Also
SearchFilter
ModIOUnityAsync.UploadModfile
ModIOUnityAsync.GetMultipartUploadParts
ModId modId;
string uploadId;
SearchFilter filter;
private void Example()
{
ModIOUnity.GetMultipartUploadParts(modId, uploadId, filter, Callback);
}
void Callback(ResultAnd<MultipartUploadSessionsObject> response)
{
if (response.result.Succeeded())
{
Debug.Log("Received Upload Sessions Object");
}
else
{
Debug.Log("Failed to get Upload Sessions Object");
}
}
AddMultipartUploadParts
public static void AddMultipartUploadParts(ModId modId, string uploadId, string contentRange, string digest, byte[] rawBytes, Action<Result> callback)
Add a new multipart upload part to an existing upload session. All parts must be exactly 50MB (Mebibyte) in size unless it is the final part which can be smaller. A successful request will return a single Multipart Upload Part Object. NOTE: Unlike other POST endpoints on this service, the body of this request should contain no form parameters and instead be the data described in the byte range of the Content-Range header of the request. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
contentRange
The Content-Range of the file you are sending.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
digest
Optional Digest for part integrity checks once the part has been uploaded.
rawBytes
Bytes for the file part to be uploaded
callback
a callback with the Result of the operation
See Also
ModIOUnityAsync.UploadModfile
ModIOUnityAsync.AddMultipartUploadParts
ModId modId;
string uploadId;
string contentRange;
string digest;
byte[] rawBytes;
private void Example()
{
ModIOUnity.AddMultipartUploadParts(modId, uploadId, contentRange, digest, rawBytes, Callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Added a part to Upload Session");
}
else
{
Debug.Log("Failed to add a part to Upload Session");
}
}
CreateMultipartUploadSession
public static void CreateMultipartUploadSession(ModId modId, string filename, string nonce
Create a new multipart upload session. A successful request will return a single Multipart Upload Object. NOTE: The multipart upload system is designed for uploading large files up to 20GB in size. If uploading files less than 100MB, we recommend using the Add Modfile endpoint. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
nonce
An optional nonce to provide to prevent duplicate upload sessions from being created concurrently. Maximum of 64 characters.
filename
The filename of the file once all the parts have been uploaded. The filename must include the .zip extension and cannot exceed 100 characters.
callback
a callback with the Result of the operation
See Also
ModIOUnityAsync.UploadModfile
ModIOUnityAsync.CreateMultipartUploadSession
ModId modId;
string filename;
string nonce;
private void Example()
{
ModIOUnity.CreateMultipartUploadSession(modId, filename, nonce, Callback);
}
void Callback(ResultAnd<MultipartUploadObject> response)
{
if (response.result.Succeeded())
{
Debug.Log("Created Upload Session");
}
else
{
Debug.Log("Failed to Create Upload Session");
}
}
DeleteMultipartUploadSession
public static void DeleteMultipartUploadSession(ModId modId, string uploadId, Action<Result> callback)
Terminate an active multipart upload session, a successful request will return 204 No Content. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
callback
a callback with the Result of the operation
See Also
ModIOUnityAsync.DeleteMultipartUploadSession
ModIOUnityAsync.UploadModfile
ModId modId;
string uploadId;
private void Example()
{
ModIOUnity.DeleteMultipartUploadSession(modId, uploadId, Callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Deleted Upload Session");
}
else
{
Debug.Log("Failed to Delete Upload Session");
}
}
CompleteMultipartUploadSession
public static void CompleteMultipartUploadSession(ModId modId, string uploadId, Action<Result> callback)
Complete an active multipart upload session, this endpoint assumes that you have already uploaded all individual parts. A successful request will return a 200 OK response code and return a single Multipart Upload Object. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
callback
a callback with the Result of the operation
See Also
ModIOUnityAsync.CompleteMultipartUploadSession
ModIOUnityAsync.UploadModfile
ModId modId;
string uploadId;
private void Example()
{
ModIOUnity.CompleteMultipartUploadSession(modId, uploadId, Callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Completed Session");
}
else
{
Debug.Log("Failed to complete session");
}
}
DownloadImage
public static void DownloadImage(DownloadReference downloadReference, Action<ResultAnd<byte[]>> callback)
Downloads a texture based on the specified download reference.
Remarks
You can get download references from UserProfiles and ModProfiles
Parameters
downloadReference
download reference for the texture (eg UserObject.avatar_100x100)
callback
callback with the Result and Texture2D from the download
See Also
Result
DownloadReference
Texture2D
ModIOUnityAsync.DownloadTexture
ModProfile mod;
void Example()
{
ModIOUnity.DownloadTexture(mod.logoImage_320x180, DownloadTextureCallback);
}
void DownloadTextureCallback(ResultAnd<Texture2D> response)
{
if (response.result.Succeeded())
{
Debug.Log("downloaded the mod logo texture");
}
else
{
Debug.Log("failed to download the mod logo texture");
}
}
Report
public static void Report(Report report, Action<Result> callback)
Reports a specified mod to mod.io.
Parameters
report
the object containing all of the details of the report you are sending
callback
callback with the Result of the report
See Also
Report
Result
ModIOUnityAsync.Report
void Example()
{
Report report = new Report(new ModId(123),
ReportType.Generic,
"reporting this mod for a generic reason",
"JohnDoe",
"johndoe@mod.io");
ModIOUnity.Report(report, ReportCallback);
}
void ReportCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("successfully sent a report");
}
else
{
Debug.Log("failed to send a report");
}
}
SyncEntitlements
public static void SyncEntitlements(Action<ResultAnd<Entitlement[]>> callback)
Convert an in-game consumable that a user has purchased on Steam, Xbox, or Psn into a users mod.io inventory. This endpoint will consume the entitlement on behalf of the user against the portal in which the entitlement resides (i.e. Steam, Xbox, Psn).
Parameters
callback
a callback with the Result of the operation
See Also
Entitlement
EntitlementObject
ModIOUnityAsync.SyncEntitlements
private void Example()
{
ModIOUnity.SyncEntitlements();
}
void Callback(ResultAnd<Entitlement[]> response)
{
if (response.result.Succeeded())
{
Debug.Log("Sync Entitlements Success");
}
else
{
Debug.Log("Failed to Sync Entitlements");
}
}
PurchaseMod
public static void PurchaseMod(ModId modId, int displayAmount, string idempotent, bool subscribeOnPurchase, Action<ResultAnd<CheckoutProcess>> callback)
Complete a marketplace purchase. A Successful request will return the newly created Checkout Process Object. Parameter|Type|Required|Description ---|---|---|---| transaction_id|integer|true|The id of the transaction to complete. mod_id|integer|true|The id of the mod associated to this transaction. display_amount|integer|true|The expected amount of the transaction to confirm the displayed amount matches the actual amount.
Parameters
modId
The id of the mod the user wants to purchase.
displayAmount
The amount that was shown to the user for the purchase.
idempotent
A unique string. Must be alphanumeric and cannot contain unique characters except for -
subscribeOnPurchase
Automatically subscribe to the mod after purchase
callback
callback with the result of the operation
See Also
string idempotent = $"aUniqueKey";
ModId modId = 1234;
int displayAmount = 12;
void Example()
{
ModIOUnity.PurchaseMod(modId, displayAmount, idempotent, Callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Completed Purchase");
}
else
{
Debug.Log("failed to complete purchase");
}
}
GetPurchasedMods
public static ModProfile[] GetPurchasedMods(out Result result)
Retrieves all of the purchased mods for the current user.
Parameters
result
an out parameter for whether or not the method succeeded
See Also
Returns
an array of the user's purchased mods
void Example()
{
ModProfile[] mods = ModIOUnity.GetPurchasedMods(out Result result);
if (result.Succeeded())
{
Debug.Log("user has " + mods.Length + " purchased mods");
}
else
{
Debug.Log("failed to get purchased mods");
}
}
GetUserWalletBalance
public static void GetUserWalletBalance(Action<ResultAnd<Wallet>> callback)
Get user's wallet balance
Parameters
callback
callback with the result of the operation
See Also
void Example()
{
ModIOUnity.GetUserWalletBalance(filter, Callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Get balance Success");
}
else
{
Debug.Log("failed to get balance");
}
}
GetGameTokenPacks
public static void GetGameTokenPacks(Action<ResultAnd<TokenPack[]>> callback)
StartAnalyticsSession
public static void StartAnalyticsSession(string sessionId, long[] modIds, bool startHeartbeat, Action<Result> callback)
Send Request to start tracking playtime analytics. Best used after a player has loaded into the game with their selected mods. Multiple sessions can be active, however the session ids must be unique.
Parameters
sessionId
Must be unique (guid)
modIds
Mods used for this session.
startHeartbeat
Starts a heartbeat coroutine that will ping the server around every 5 min
callback
callback with the result of the operation
See Also
StartAnalyticsSession
ModIOUnityAsync.StartAnalyticsSession
ModIOUnity.SendAnalyticsHeartbeat
ModIOUnityAsync.SendAnalyticsHeartbeat
ModIOUnity.EndAnalyticsSession
ModIOUnityAsync.EndAnalyticsSession
string[] modIds;
string sessionId;
void Example()
{
ModIOUnity.StartAnalyticsSession(sessionId, modIds, true, Callback);
}
void ReportCallback(ResultAnd<string> r)
{
if (r.result.Succeeded())
{
//Store the returned session id to end the session later.
sessionId = r.value;
Debug.Log("successful");
}
else
{
Debug.Log("failed");
}
}
SendAnalyticsHeartbeat
public static void SendAnalyticsHeartbeat(string sessionId, Action<Result> callback)
Send Request to start tracking playtime analytics. Best used after a player has loaded into the game with their selected mods. Multiple sessions can be active, however the session ids must be unique.
Parameters
sessionId
Must be unique (guid)
callback
callback with the result of the operation
See Also
StartAnalyticsSession
ModIOUnityAsync.StartAnalyticsSession
ModIOUnity.SendAnalyticsHeartbeat
ModIOUnityAsync.SendAnalyticsHeartbeat
ModIOUnity.EndAnalyticsSession
ModIOUnityAsync.EndAnalyticsSession
string sessionId;
void Example()
{
ModIOUnity.StartAnalyticsSession(sessionId, Callback);
}
void ReportCallback(Result r)
{
if (r.result.Succeeded())
{
//Store the returned session id to end the session later.
sessionId = r.value;
Debug.Log("successful");
}
else
{
Debug.Log("failed");
}
}
EndAnalyticsSession
public static void EndAnalyticsSession(string sessionId, Action<Result> callback)
Send Request to end the tracking of playtime analytics. Best used after a player has left an in game session.
Parameters
sessionId
Session id associated with the session you want to end.
callback
callback with the result of the operation
See Also
StartAnalyticsSession
ModIOUnityAsync.StartAnalyticsSession
ModIOUnity.SendAnalyticsHeartbeat
ModIOUnityAsync.SendAnalyticsHeartbeat
ModIOUnity.EndAnalyticsSession
ModIOUnityAsync.EndAnalyticsSession
string sessionId;
void Example()
{
ModIOUnity.EndAnalyticsSession(sessionId, Callback);
}
void ReportCallback(Result result)
{
if (result.Succeeded())
{
Debug.Log("successful");
}
else
{
Debug.Log("failed");
}
}
RequestUserDelegationToken
public static void RequestUserDelegationToken(Action<ResultAnd<UserDelegationToken>> callback)
Requests a User Delegation Token on behalf of a authenticated user. This token should then be sent to your secure backend server where you can then use it for specific endpoints.
Parameters
callback
callback with the result of the operation
CreateTempModSet
public static void CreateTempModSet(ModId[] modIds, Action<Result> callback)
Creates a Temp mod set
Parameters
modIds
Mods used for this set.
callback
callback with the result of the operation
See Also
ModIOUnityAsync.CreateTempModSet
ModIOUnity.DeleteTempModSet
ModIOUnity.AddModsToTempModSet
ModIOUnity.RemoveModsFromTempModSet
ModIOUnity.GetTempSystemInstalledMods
ModId[] modIds;
void Example()
{
ModIOUnity.CreateTempModSet(modIds, callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
DeleteTempModSet
public static Result DeleteTempModSet()
Removes a Temp mod set
See Also
ModIOUnity.CreateTempModSet
ModIOUnity.AddModsToTempModSet
ModIOUnity.RemoveModsFromTempModSet
ModIOUnity.GetTempSystemInstalledMods
void Example()
{
ModIOUnity.DeleteTempModSet(callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
AddModsToTempModSet
public static void AddModsToTempModSet(ModId[] modIds, Action<Result> callback)
Adds mods to a Temp mod set
Parameters
modIds
Mods used for this set.
callback
callback with the result of the operation
See Also
ModIOUnity.CreateTempModSet
ModIOUnity.DeleteTempModSet
ModIOUnityAsync.AddModsToTempModSet
ModIOUnity.RemoveModsFromTempModSet
ModIOUnity.GetTempSystemInstalledMods
ModId[] modIds;
void Example()
{
ModIOUnity.AddModToTempModSet(modIds, callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
RemoveModsFromTempModSet
public static Result RemoveModsFromTempModSet(IEnumerable<ModId> modIds)
Removes mods from a Temp mod set
Parameters
modIds
Mods used for this set.
See Also
ModIOUnity.CreateTempModSet
ModIOUnity.DeleteTempModSet
ModIOUnity.AddModsToTempModSet
ModIOUnity.GetTempSystemInstalledMods
ModId[] modIds;
void Example()
{
ModIOUnity.RemoveModsFromTempModSet(modIds, callback);
}
void Callback(Result result)
{
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
GetTempSystemInstalledMods
public static InstalledMod[] GetTempSystemInstalledMods(out Result result)
Gets an array of temp 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 temp installed mods
Returns
an array of InstalledMod for each existing temp mod installed on the current device (and not subscribed by the current user)
See Also
InstalledMod
GetSubscribedMods
ModIOUnity.CreateTempModSet
ModIOUnity.DeleteTempModSet
ModIOUnityAsync.AddModsToTempModSet
ModIOUnity.RemoveModsFromTempModSet
void Example()
{
InstalledMod[] mods = ModIOUnity.GetTempSystemInstalledMods(out Result result);
if (result.Succeeded())
{
Debug.Log("found " + mods.Length.ToString() + " temp mods installed");
}
else
{
Debug.Log("failed to get temp installed mods");
}
}
ModIOUnityAsync
public static class ModIOUnityAsync
Main async interface for the mod.io Unity plugin.
Remarks
Every ModIOUnityAsync
method has a callback alternative in ModIOUnity
.
See Also
Method
Shutdown
public static async Task Shutdown()
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.
await ModIOUnityAsync.Shutdown();
Debug.Log("Plugin shutdown complete");
See Also
Ping
public static Task<Result> Ping()
Pings the server.
Result.Succeeded()
will be true
if a response was received.
RequestExternalAuthentication
public static async Task<ResultAnd<ExternalAuthenticationToken>> RequestExternalAuthentication()
Listen for an external login attempt. Returns an that includes the url and code to display to the user. ExternalAuthenticationToken.task
will complete once the user enters the code.
Remarks
The request will time out after 15 minutes. You can cancel it at any time using token.Cancel()
.
var response = await ModIOUnityAsync.RequestExternalAuthentication();
if (!response.result.Succeeded())
{
Debug.Log($"RequestExternalAuthentication failed: {response.result.message}");
return;
}
See Also
Result
ResultAnd
ExternalAuthenticationToken
RequestAuthenticationEmail
public static async Task<Result> RequestAuthenticationEmail(string emailaddress)
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 operation 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"
See Also
SubmitEmailSecurityCode
Result
async void Example()
{
Result result = await ModIOUnityAsync.RequestAuthenticationEmail("johndoe@gmail.com");
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 async Task<Result> SubmitEmailSecurityCode(string securityCode)
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
See Also
RequestAuthenticationEmail
Result
async void Example(string userSecurityCode)
{
Result result = await ModIOUnityAsync.SubmitEmailSecurityCode(userSecurityCode);
if (result.Succeeded())
{
Debug.Log("You have successfully authenticated the user");
}
else
{
Debug.Log("Failed to authenticate the user");
}
}
GetTermsOfUse
public static async Task<ResultAnd<TermsOfUse>> GetTermsOfUse()
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 operation 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()
See Also
TermsOfUse
AuthenticateUserViaDiscord
AuthenticateUserViaGoogle
AuthenticateUserViaGOG
AuthenticateUserViaItch
AuthenticateUserViaOculus
AuthenticateUserViaSteam
AuthenticateUserViaSwitch
AuthenticateUserViaXbox
AuthenticateUserViaPlayStation
async void Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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 async Task<Result> AuthenticateUserViaSteam(string steamToken, string emailAddress, TermsHash? hash)
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()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaSteam(steamToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaEpic
public static async Task<Result> AuthenticateUserViaEpic(string epicToken, string emailAddress, TermsHash? hash)
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()
See Also
GetTermsOfUse
ModIOUnity.AuthenticateUserViaEpic
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaEpic(epicToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaPlayStation
public static async Task<Result> AuthenticateUserViaPlayStation(string authCode, string emailAddress, TermsHash? hash, PlayStationEnvironment environment)
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
authCode
the user's authcode token
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
environment
the PSN account environment
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaPlayStation(authCode, "johndoe@gmail.com", modIOTermsOfUse.hash, PlayStationEnvironment.np);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaGOG
public static async Task<Result> AuthenticateUserViaGOG(string gogToken, string emailAddress, TermsHash? hash)
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 steam token
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaGOG(gogToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaItch
public static async Task<Result> AuthenticateUserViaItch(string itchioToken, string emailAddress, TermsHash? hash)
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 steam token
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaItch(itchioToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaXbox
public static async Task<Result> AuthenticateUserViaXbox(string xboxToken, string emailAddress, TermsHash? hash)
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 steam token
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaItch(xboxToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaSwitch
public static async Task<Result> AuthenticateUserViaSwitch(string switchToken, string emailAddress, TermsHash? hash)
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
switchToken
the user's steam token
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaItch(switchToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaDiscord
public static async Task<Result> AuthenticateUserViaDiscord(string discordToken, string emailAddress, TermsHash? hash)
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 steam token
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaDiscord(discordToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaGoogle
public static async Task<Result> AuthenticateUserViaGoogle(string token, string emailAddress, TermsHash? hash)
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()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaGoogle(token, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaApple
public static async Task<Result> AuthenticateUserViaApple(string authCode, string emailAddress, TermsHash? hash)
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()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaApple(authCode, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaOculus
public static async Task<Result> AuthenticateUserViaOculus(OculusDevice oculusDevice, string nonce, long userId, string oculusToken, string emailAddress, TermsHash? hash)
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
oculusToken
the user's oculus token
oculusDevice
the device you're authenticating on
nonce
the nonce
userId
the user id
emailAddress
the user's email address (Can be null)
hash
the TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaOculus(OculusDevice.Quest,
nonce,
userId,
oculusToken,
"johndoe@gmail.com",
modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
AuthenticateUserViaOpenId
public static async Task<Result> AuthenticateUserViaOpenId(string idToken, string emailAddress, TermsHash? hash)
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()
See Also
// First we get the Terms of Use to display to the user and cache the hash
async void GetTermsOfUse_Example()
{
ResultAnd<TermsOfUser> response = await ModIOUnityAsync.GetTermsOfUse();
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
async void Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaOpenId(idToken,
"johndoe@gmail.com",
modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}
IsAuthenticated
public static async Task<Result> IsAuthenticated()
Informs you if the current user session is authenticated or not.
See Also
async void Example()
{
Result result = await ModIOUnityAsync.IsAuthenticated();
if (result.Succeeded())
{
Debug.Log("current session is authenticated");
}
else
{
Debug.Log("current session is not authenticated");
}
}
GetTagCategories
public static async Task<ResultAnd<TagCategory[]>> GetTagCategories()
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
See Also
SearchFilter
TagCategory
Result
async void Example()
{
ResultAnd<TagCategory[]> response = await ModIOUnityAsync.GetTagCategories();
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");
}
}
GetMods
public static async Task<ResultAnd<ModPage>> GetMods(SearchFilter filter)
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)
See Also
async void Example()
{
SearchFilter filter = new SearchFilter();
filter.SetPageIndex(0);
filter.SetPageSize(10);
ResultAnd<ModPage> response = await ModIOUnityAsync.GetMods(filter);
if (response.result.Succeeded())
{
Debug.Log("ModPage has " + response.value.modProfiles.Length + " mods");
}
else
{
Debug.Log("failed to get mods");
}
}
GetMod
public static async Task<ResultAnd<ModProfile>> GetMod(ModId modId)
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
See Also
async void Example()
{
ModId modId = new ModId(1234);
ResultAnd<ModProfile> response = await ModIOUnityAsync.GetMod(modId);
if (response.result.Succeeded())
{
Debug.Log("retrieved mod " + response.value.name);
}
else
{
Debug.Log("failed to get mod");
}
}
GetModSkipCache
public static Task<ResultAnd<ModProfile>> GetModSkipCache(ModId modId)
GetModComments
public static async Task<ResultAnd<CommentPage>> GetModComments(ModId modId, SearchFilter filter)
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
modId
the ModId of the comments to get
filter
The filter to apply when searching through comments (can only apply
pagination parameters, Eg. page size and page index)
See Also
CommentPage
ModComment
SearchFilter
ModId
Result
ResultAnd
ModIOUnity.GetModComments
AddModComment
public static async Task<ResultAnd<ModComment>> AddModComment(ModId modId, CommentDetails commentDetails)
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.
See Also
ModId
Result
ResultAnd
ModDependenciesObject
ModIOUnity.GetModDependencies
async void Example()
{
ModId modId = new ModId(1234);
var resultAnd = await ModIOUnityAsync.GetModDependencies(modId);
if (resultAnd.result.Succeeded())
{
ModDependenciesObject[] modDependenciesObjects = resultAnd.value;
Debug.Log("retrieved mods dependencies");
}
else
{
Debug.Log("failed to get mod dependencies");
}
}
Parameters
modId
commentDetails
Returns
DeleteModComment
public static async Task<Result> DeleteModComment(ModId modId, long commentId)
Delete a comment from a mod profile. Successful request will return 204 No Content and fire a MOD_COMMENT_DELETED event.
Parameters
modId
Id of the mod to add the comment to
commentId
The id for the comment to be removed
See Also
Result
ModComment
CommentDetails
DeleteModComment
ModIOUnity.DeleteModComment
EditModComment
private ModId modId;
private long commentId;
void Example()
{
var result = await ModIOUnityAsync.DeleteModComment(modId, commentId);
if (result.Succeeded())
{
Debug.Log("deleted comment");
}
else
{
Debug.Log("failed to delete comment");
}
}
UpdateModComment
public static async Task<ResultAnd<ModComment>> UpdateModComment(ModId modId, string content, long commentId)
Update a comment for the corresponding mod. Successful request will return the updated Comment Object.
Parameters
modId
Id of the mod the comment is on
content
Updated contents of the comment.
commentId
The id for the comment you wish to edit
See Also
ResultAnd
ModComment
ModIOUnity.UpdateModComment
private string content = "This is a Comment";
long commentId = 12345;
ModId modId = (ModId)1234;
async void UpdateMod()
{
var response = await ModIOUnityAsync.UpdateModComment(modId, content, commentId);
if(response.result.Succeeded())
{
Debug.Log("Successfully Updated Comment!");
}
else
{
Debug.Log("Failed to Update Comment!");
}
}
GetModDependencies
public static async Task<ResultAnd<ModDependencies[]>> GetModDependencies(ModId modId)
GetCurrentUserRatings
public static async Task<ResultAnd<Rating[]>> GetCurrentUserRatings()
Get all mod rating's submitted by the authenticated user. Successful request will return an array of Rating Objects.
See Also
async void Example()
{
ResultAnd<Rating[]> response = await ModIOUnityAsync.GetCurrentUserRatings();
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 async Task<ResultAnd<ModRating>> GetCurrentUserRatingFor(ModId modId)
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
See Also
async void Example()
{
ModId modId = new ModId(1234);
ResultAnd<ModRating> response = await ModIOUnityAsync.GetCurrentUserRatingFor(modId);
if (response.result.Succeeded())
{
Debug.Log($"retrieved rating: {response.value}");
}
else
{
Debug.Log("failed to get rating");
}
}
RateMod
public static async Task<Result> RateMod(ModId modId, ModRating rating)
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
See Also
ModProfile mod;
async void Example()
{
Result result = await ModIOUnityAsync.RateMod(mod.id, ModRating.Positive);
if (result.Succeeded())
{
Debug.Log("Successfully rated mod");
}
else
{
Debug.Log("Failed to rate mod");
}
}
SubscribeToMod
public static async Task<Result> SubscribeToMod(ModId modId)
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
See Also
Result
ModId
ModIOUnity.EnableModManagement(ModIO.ModManagementEventDelegate)
ModIOUnity.GetCurrentModManagementOperation
ModProfile mod;
async void Example()
{
Result result = await ModIOUnityAsync.SubscribeToMod(mod.id);
if (result.Succeeded())
{
Debug.Log("Successfully subscribed to mod");
}
else
{
Debug.Log("Failed to subscribe to mod");
}
}
UnsubscribeFromMod
public static async Task<Result> UnsubscribeFromMod(ModId modId)
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
See Also
Result
ModId
ModIOUnity.EnableModManagement(ModIO.ModManagementEventDelegate)
ModIOUnity.GetCurrentModManagementOperation
ModProfile mod;
async void Example()
{
Result result = await ModIOUnityAsync.UnsubscribeFromMod(mod.id);
if (result.Succeeded())
{
Debug.Log("Successfully unsubscribed from mod");
}
else
{
Debug.Log("Failed to unsubscribe from mod");
}
}
GetCurrentUser
public static async Task<ResultAnd<UserProfile>> GetCurrentUser(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
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
async void Example()
{
ResultAnd<UserProfile> response = await ModIOUnityAsync.GetCurrentUser();
if (response.result.Succeeded())
{
Debug.Log("Got user: " + response.value.username);
}
else
{
Debug.Log("failed to get user");
}
}
DownloadNow
public static async void DownloadNow(ModId modId)
Stops any current download and starts downloading the selected mod.
Parameters
modId
ModId of the mod you want to remove dependencies from
See Also
Result
ModId
ModIOUnityAsync.DownloadNow
ModId modId;
void Example()
{
Result result = ModIOUnity.DownloadNow(modId);
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
MuteUser
public static async Task<Result> MuteUser(long userId)
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
See Also
UnmuteUser
public static async Task<Result> UnmuteUser(long userId)
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
See Also
GetMutedUsers
public static async Task<ResultAnd<UserProfile[]>> GetMutedUsers()
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.
See Also
FetchUpdates
public static async Task<Result> FetchUpdates()
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.
See Also
Result
ModIOUnity.EnableModManagement(ModIO.ModManagementEventDelegate)
IsAuthenticated
RequestAuthenticationEmail
SubmitEmailSecurityCode
AuthenticateUserViaDiscord
AuthenticateUserViaGoogle
AuthenticateUserViaGOG
AuthenticateUserViaItch
AuthenticateUserViaOculus
AuthenticateUserViaSteam
AuthenticateUserViaSwitch
AuthenticateUserViaXbox
async void Example()
{
Result result = await ModIOUnityAsync.FetchUpdates();
if (result.Succeeded())
{
Debug.Log("updated user subscriptions");
}
else
{
Debug.Log("failed to get user subscriptions");
}
}
AddDependenciesToMod
public static async Task<Result> AddDependenciesToMod(ModId modId, ICollection<ModId> dependencies)
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)
See Also
Result
ModId
ModIOUnity.AddDependenciesToMod
ModIOUnity.RemoveDependenciesFromMod
ModIOUnityAsync.RemoveDependenciesFromMod
async void Example()
{
var dependencies = new List<ModId>
{
(ModId)1001,
(ModId)1002,
(ModId)1003
};
Result result = await ModIOUnityAsync.AddDependenciesToMod(mod.id, dependencies);
if (result.Succeeded())
{
Debug.Log("Successfully added dependencies to mod");
}
else
{
Debug.Log("Failed to add dependencies to mod");
}
}
RemoveDependenciesFromMod
public static async Task<Result> RemoveDependenciesFromMod(ModId modId, ICollection<ModId> dependencies)
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)
See Also
Result
ModId
dependencies
ModIOUnity.AddDependenciesToMod
ModIOUnity.RemoveDependenciesFromMod
ModIOUnityAsync.AddDependenciesToMod
void Example()
{
var dependencies = new List<ModId>
{
(ModId)1001,
(ModId)1002,
(ModId)1003
};
Result result = await ModIOUnityAsync.RemoveDependenciesFromMod(mod.id, dependencies);
if (result.Succeeded())
{
Debug.Log("Successfully removed dependencies from mod");
}
else
{
Debug.Log("Failed to removed dependencies from mod");
}
}
GetModKvpMetadata
public static async Task<ResultAnd<Dictionary<string, string>>> GetModKvpMetadata(long modId)
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()
{
ResultAnd<MetadataKvp[]> r = await ModIOUnityAsync.GetModKvpMetadata(modId);
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 async Task<Result> AddModKvpMetadata(long modId, Dictionary<string, string> metadata)
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);
if (result.Succeeded())
{
Debug.Log("Successfully added metadata.");
}
else
{
Debug.Log("Failed to add metadata.");
}
}
DeleteModKvpMetadata
public static async Task<Result> DeleteModKvpMetadata(long modId, Dictionary<string, string> metadata)
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()
{
Result result = await ModIOUnityAsync.DeleteModKvpMetadata(modId, metadata);
if (result.Succeeded())
{
Debug.Log("Successfully deleted metadata");
}
else
{
Debug.Log("Failed to delete metadata.");
}
}
CreateModProfile
public static async Task<ResultAnd<ModId>> CreateModProfile(CreationToken token, ModProfileDetails modProfileDetails)
Creates a new mod profile on the mod.io server based on the details provided from the ModProfileDetails object provided. Note that you must have a logo, name and summary assigned in ModProfileDetails in order for this to work.
Remarks
Note that this will create a new profile on the server and can be viewed online through a browser.
Parameters
token
the token allowing a new unique profile to be created from ModIOUnity.GenerateCreationToken()
modProfileDetails
the mod profile details to apply to the mod profile being created
See Also
ModIOUnity.GenerateCreationToken
CreationToken
ModProfileDetails
Result
ModId
ModId newMod;
Texture2D logo;
CreationToken token;
async void Example()
{
token = ModIOUnity.GenerateCreationToken();
ModProfileDetails profile = new ModProfileDetails();
profile.name = "mod name";
profile.summary = "a brief summary about this mod being submitted"
profile.logo = logo;
ResultAnd<ModId> response = await ModIOUnityAsync.CreateModProfile(token, profile);
if (response.result.Succeeded())
{
newMod = response.value;
Debug.Log("created new mod profile with id " + response.value.ToString());
}
else
{
Debug.Log("failed to create new mod profile");
}
}
EditModProfile
public static async Task<Result> EditModProfile(ModProfileDetails modprofile)
This is used to edit or change data in an existing mod profile on the mod.io server.
Remarks
You need to assign the ModId of the mod you want to edit inside of the ModProfileDetails object included in the parameters
Parameters
modprofile
the mod profile details to apply to the mod profile being created
See Also
ModId modId;
async void Example()
{
ModProfileDetails profile = new ModProfileDetails();
profile.modId = modId;
profile.summary = "a new brief summary about this mod being edited"
Result result = await ModIOUnityAsync.EditModProfile(profile);
if (result.Succeeded())
{
Debug.Log("edited mod profile");
}
else
{
Debug.Log("failed to edit mod profile");
}
}
UploadModfile
public static async Task<Result> UploadModfile(ModfileDetails modfile)
Used to upload a mod file to a mod profile on the mod.io server. A mod file is the actual archive of a mod. This method can be used to update a mod to a newer version (you can include changelog information in ModfileDetails).
Parameters
modfile
the mod file and details to upload
See Also
Result
ModfileDetails
ArchiveModProfile
ModIOUnity.GetCurrentUploadHandle
ModId modId;
async void Example()
{
ModfileDetails modfile = new ModfileDetails();
modfile.modId = modId;
modfile.directory = "files/mods/mod_123";
Result result = await ModIOUnityAsync.UploadModfile(modfile);
if (result.Succeeded())
{
Debug.Log("uploaded mod file");
}
else
{
Debug.Log("failed to upload mod file");
}
}
UploadModMedia
public static Task<Result> UploadModMedia(ModProfileDetails modProfileDetails)
This is used to update the logo of a mod or the gallery images. This works very similar to EditModProfile except it only affects the images.
Parameters
modProfileDetails
this holds the reference to the images you wish to upload
See Also
ModProfileDetails
Result
EditModProfile
ModId modId;
Texture2D newTexture;
async void Example()
{
ModProfileDetails profile = new ModProfileDetails();
profile.modId = modId;
profile.logo = newTexture;
Result result = await ModIOUnityAsync.UploadModMedia(profile);
if (result.Succeeded())
{
Debug.Log("uploaded new mod logo");
}
else
{
Debug.Log("failed to uploaded mod logo");
}
}
ReorderModMedia
public static Task<ResultAnd<ModProfile>> ReorderModMedia(ModId modId, string[] orderedFilenames)
Reorder a mod's gallery images. orderedFilenames
must represent every entry in (or any of the size-variant arrays) or the operation will fail.
Returns the updated ModProfile
.
DeleteModMedia
public static Task<ResultAnd<ModProfile>> DeleteModMedia(ModId modId, string[] filenames)
Delete gallery images from a mod. Filenames can be sourced from (or any of the size-variant arrays).
Returns the updated ModProfile
.
ArchiveModProfile
public static async Task<Result> ArchiveModProfile(ModId modId)
Removes a mod from being visible on the mod.io server.
Remarks
If you want to delete a mod permanently you can do so from a web browser.
Parameters
modId
the id of the mod to delete
See Also
Result
CreateModProfile
EditModProfile
ModId modId;
async void Example()
{
Result result = await ModIOUnityAsync.ArchiveModProfile(modId);
if (result.Succeeded())
{
Debug.Log("archived mod profile");
}
else
{
Debug.Log("failed to archive mod profile");
}
}
GetCurrentUserCreations
public static async Task<ResultAnd<ModPage>> GetCurrentUserCreations(SearchFilter filter)
Get all mods the authenticated user added or is a team member of. Successful request will return an array of Mod Objects. We recommended reading the filtering documentation to return only the records you want.
AddTags
public static async Task<Result> AddTags(ModId modId, string[] tags)
Adds the provided tags to the specified mod id. In order for this to work the authenticated user must have permission to edit the specified mod. Only existing tags as part of the game Id will be added.
Parameters
modId
Id of the mod to add tags to
tags
array of tags to be added
See Also
Result
DeleteTags
ModIOUnityAsync.AddTags
ModId modId;
string[] tags;
async void Example()
{
Result result = await ModIOUnity.AddTags(modId, tags);
if (result.Succeeded())
{
Debug.Log("added tags");
}
else
{
Debug.Log("failed to add tags");
}
}
DeleteTags
public static async Task<Result> DeleteTags(ModId modId, string[] tags)
Deletes the specified tags from the mod. In order for this to work the authenticated user must have permission to edit the specified mod.
Parameters
modId
the id of the mod for deleting tags
tags
array of tags to be deleted
See Also
Result
AddTags
ModIOUnityAsync.DeleteTags
ModId modId;
string[] tags;
async void Example()
{
Result result = await ModIOUnity.DeleteTags(modId, tags);
if (result.Succeeded())
{
Debug.Log("deleted tags");
}
else
{
Debug.Log("failed to delete tags");
}
}
GetMultipartUploadParts
public static async Task<ResultAnd<PaginatedResponse<MultipartUploadPart>>> GetMultipartUploadParts(ModId modId, string uploadId, SearchFilter filter)
Get all uploaded parts for a corresponding upload session. Successful request will return an array of Multipart Upload Part Objects.We recommended reading the filtering documentation to return only the records you want. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
filter
The filter to apply when searching through comments (can only apply
pagination parameters, Eg. page size and page index)
See Also
SearchFilter
ModIOUnity.GetMultipartUploadParts
ModIOUnity.UploadModfile
ModId modId;
string uploadId;
private void Example()
{
var response = await ModIOUnityAsync.GetMultipartUploadParts(modId, uploadId);
if (response.result.Succeeded())
{
Debug.Log("Received Upload Sessions Object");
}
else
{
Debug.Log("Failed to get Upload Sessions Object");
}
}
GetMultipartUploadSessions
public static async Task<ResultAnd<PaginatedResponse<MultipartUpload>>> GetMultipartUploadSessions(ModId modId, SearchFilter filter)
Get all upload sessions belonging to the authenticated user for the corresponding mod. Successful request will return an array of Multipart Upload Part Objects. We recommended reading the filtering documentation to return only the records you want. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
filter
The filter to apply when searching through comments (can only apply
pagination parameters, Eg. page size and page index)
See Also
SearchFilter
ModIOUnity.GetMultipartUploadSessions
ModIOUnity.UploadModfile
ModId modId;
private void Example()
{
var response = await ModIOUnity.GetMultipartUploadSessions(modId);
if (response.result.Succeeded())
{
Debug.Log("Received Upload Sessions");
}
else
{
Debug.Log("Failed to get Upload Sessions");
}
}
AddMultipartUploadParts
public static async Task<Result> AddMultipartUploadParts(ModId modId, string uploadId, string contentRange, string digest, byte[] rawBytes)
Add a new multipart upload part to an existing upload session. All parts must be exactly 50MB (Mebibyte) in size unless it is the final part which can be smaller. A successful request will return a single Multipart Upload Part Object. NOTE: Unlike other POST endpoints on this service, the body of this request should contain no form parameters and instead be the data described in the byte range of the Content-Range header of the request. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
contentRange
The Content-Range of the file you are sending.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
digest
Optional Digest for part integrity checks once the part has been uploaded.
rawBytes
Bytes for the file part to be uploaded
See Also
ModIOUnity.AddMultipartUploadParts
ModIOUnity.UploadModfile
ModId modId;
string uploadId;
string contentRange;
string digest;
byte[] rawBytes;
private void Example()
{
var result = await ModIOUnity.AddMultipartUploadParts(modId, uploadId, contentRange, digest, rawBytes);
if (result.Succeeded())
{
Debug.Log("Added a part to Upload Session");
}
else
{
Debug.Log("Failed to add a part to Upload Session");
}
}
CreateMultipartUploadSession
public static async Task<ResultAnd<MultipartUpload>> CreateMultipartUploadSession(ModId modId, string filename)
Create a new multipart upload session. A successful request will return a single Multipart Upload Object. NOTE: The multipart upload system is designed for uploading large files up to 20GB in size. If uploading files less than 100MB, we recommend using the Add Modfile endpoint. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
nonce
An optional nonce to provide to prevent duplicate upload sessions from being created concurrently. Maximum of 64 characters.
filename
The filename of the file once all the parts have been uploaded. The filename must include the .zip extension and cannot exceed 100 characters.
See Also
ModIOUnity.CreateMultipartUploadSession
ModIOUnity.UploadModfile
ModId modId;
string filename;
string nonce;
private void Example()
{
var response = await ModIOUnity.CreateMultipartUploadSession(modId, filename, nonce);
if (response.result.Succeeded())
{
Debug.Log("Created Upload Session");
}
else
{
Debug.Log("Failed to Create Upload Session");
}
}
DeleteMultipartUploadSession
public static async Task<Result> DeleteMultipartUploadSession(ModId modId, string uploadId)
Terminate an active multipart upload session, a successful request will return 204 No Content. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
See Also
ModIOUnity.DeleteMultipartUploadSession
ModIOUnity.UploadModfile
ModId modId;
string uploadId;
private void Example()
{
var result = await ModIOUnity.DeleteMultipartUploadSession(modId, uploadId);
if (result.Succeeded())
{
Debug.Log("Deleted Upload Session");
}
else
{
Debug.Log("Failed to Delete Upload Session");
}
}
CompleteMultipartUploadSession
public static async Task<Result> CompleteMultipartUploadSession(ModId modId, string uploadId)
Complete an active multipart upload session, this endpoint assumes that you have already uploaded all individual parts. A successful request will return a 200 OK response code and return a single Multipart Upload Object. The Mutlipart feature is automatically used when uploading a mod via UploadModFile and is limited to one upload at a time. This function is optional and is provided to allow for more control over uploading large files for those who require it.
Parameters
modId
the id of the mod
uploadId
A universally unique identifier (UUID) that represents the upload session.
See Also
ModIOUnity.CompleteMultipartUploadSession
ModIOUnity.UploadModfile
ModId modId;
string uploadId;
private void Example()
{
var result = await ModIOUnity.CompleteMultipartUploadSession(modId, uploadId);
if (result.Succeeded())
{
Debug.Log("Completed Session");
}
else
{
Debug.Log("Failed to complete session");
}
}
DownloadImage
public static async Task<ResultAnd<byte[]>> DownloadImage(DownloadReference downloadReference)
Downloads a texture based on the specified download reference.
Remarks
You can get download references from UserProfiles and ModProfiles
Parameters
downloadReference
download reference for the texture (eg UserObject.avatar_100x100)
See Also
Result
DownloadReference
Texture2D
ModProfile mod;
async void Example()
{
ResultAnd<Texture2D> response = await ModIOUnityAsync.DownloadTexture(mod.logoImage_320x180);
if (response.result.Succeeded())
{
Debug.Log("downloaded the mod logo texture");
}
else
{
Debug.Log("failed to download the mod logo texture");
}
}
Report
public static async Task<Result> Report(Report report)
Reports a specified mod to mod.io.
Parameters
report
the object containing all of the details of the report you are sending
See Also
async void Example()
{
Report report = new Report(new ModId(123),
ReportType.Generic,
"reporting this mod for a generic reason",
"JohnDoe",
"johndoe@mod.io");
Result result = await ModIOUnityAsync.Report(report);
if (result.Succeeded())
{
Debug.Log("successfully sent a report");
}
else
{
Debug.Log("failed to send a report");
}
}
SyncEntitlements
public static async Task<ResultAnd<Entitlement[]>> SyncEntitlements()
Convert an in-game consumable that a user has purchased on Steam, Xbox, or Psn into a users mod.io inventory. This endpoint will consume the entitlement on behalf of the user against the portal in which the entitlement resides (i.e. Steam, Xbox, Psn).
See Also
Entitlement
EntitlementObject
ModIOUnity.SyncEntitlements
private async void Example()
{
var response = await ModIOUnity.SyncEntitlements();
if (response.result.Succeeded())
{
Debug.Log("Sync Entitlements Success");
}
else
{
Debug.Log("Failed to Sync Entitlements");
}
}
PurchaseMod
public static async Task<ResultAnd<CheckoutProcess>> PurchaseMod(ModId modId, int displayAmount, string idempotent, bool subscribeOnPurchase)
Complete a marketplace purchase. A Successful request will return the newly created Checkout Process Object. Parameter|Type|Required|Description ---|---|---|---| transaction_id|integer|true|The id of the transaction to complete. mod_id|integer|true|The id of the mod associated to this transaction. display_amount|integer|true|The expected amount of the transaction to confirm the displayed amount matches the actual amount.
Parameters
modId
The id of the mod the user wants to purchase.
displayAmount
The amount that was shown to the user for the purchase.
idempotent
A unique string. Must be alphanumeric and cannot contain unique characters except for -.
subscribeOnPurchase
Automatically subscribe to the mod after purchase
See Also
string idempotent = $"aUniqueKey";
ModId modId = 1234;
int displayAmount = 12;
async void Example()
{
var result = await ModIOUnity.PurchaseMod(modId, displayAmount, idempotent);
if (result.Succeeded())
{
Debug.Log("Completed Purchase");
}
else
{
Debug.Log("failed to complete purchase");
}
}
GetUserWalletBalance
public static async Task<ResultAnd<Wallet>> GetUserWalletBalance()
Get user's wallet balance
See Also
void Example()
{
var result = await ModIOUnity.GetUserWalletBalance(Callback);
if (result.Succeeded())
{
Debug.Log("Get balance Success");
}
else
{
Debug.Log("failed to get balance");
}
}
GetGameTokenPacks
public static async Task<ResultAnd<TokenPack[]>> GetGameTokenPacks()
StartAnalyticsSession
public static async Task<Result> StartAnalyticsSession(string sessionId, long[] modIds, bool startHeartbeat)
Send Request to start tracking playtime analytics. Best used after a player has loaded into the game with their selected mods. Multiple sessions can be active, however the session ids must be unique.
Parameters
sessionId
Must be unique (guid)
modIds
Mods used for this session.
startHeartbeat
Starts a heartbeat coroutine that will ping the server around every 5 min
See Also
StartAnalyticsSession
ModIOUnityAsync.StartAnalyticsSession
ModIOUnity.SendAnalyticsHeartbeat
ModIOUnityAsync.SendAnalyticsHeartbeat
ModIOUnity.EndAnalyticsSession
ModIOUnityAsync.EndAnalyticsSession
string[] modIds;
string sessionId;
async void Example()
{
ResultAnd<string> r = await ModIOUnityAsync.StartAnalyticsSession(sessionId, modIds);
if (r.result.Succeeded())
{
//Store the returned session id to end the session later.
sessionId = r.value;
Debug.Log("successful");
}
else
{
Debug.Log("failed");
}
}
SendAnalyticsHeartbeat
public static async Task<Result> SendAnalyticsHeartbeat(string sessionId)
Send Request to start tracking playtime analytics. Best used after a player has loaded into the game with their selected mods. Multiple sessions can be active, however the session ids must be unique.
Parameters
sessionId
Must be unique (guid)
See Also
StartAnalyticsSession
ModIOUnityAsync.StartAnalyticsSession
ModIOUnity.SendAnalyticsHeartbeat
ModIOUnityAsync.SendAnalyticsHeartbeat
ModIOUnity.EndAnalyticsSession
ModIOUnityAsync.EndAnalyticsSession
string sessionId;
async void Example()
{
Result r = await ModIOUnityAsync.SendAnalyticsHeartbeat(sessionId);
if (r.result.Succeeded())
{
Debug.Log("successful");
}
else
{
Debug.Log("failed");
}
}
EndAnalyticsSession
public static async Task<Result> EndAnalyticsSession(string sessionId)
Send Request to end the tracking of playtime analytics. Best used after a player has left an in game session.
Parameters
sessionId
The session id
See Also
StartAnalyticsSession
ModIOUnityAsync.StartAnalyticsSession
ModIOUnity.SendAnalyticsHeartbeat
ModIOUnityAsync.SendAnalyticsHeartbeat
ModIOUnity.EndAnalyticsSession
ModIOUnityAsync.EndAnalyticsSession
string sessionId;
async void Example()
{
Result result = await ModIOUnityAsync.EndAnalyticsSession(sessionId);
if (result.Succeeded())
{
Debug.Log("successful");
}
else
{
Debug.Log("failed");
}
}
RequestUserDelegationToken
public static async Task<ResultAnd<UserDelegationToken>> RequestUserDelegationToken()
Requests a User Delegation Token on behalf of a authenticated user. This token should then be sent to your secure backend server where you can then use it for specific endpoints.
CreateTempModSet
public static async Task<Result> CreateTempModSet(ModId[] modIds)
Creates a Temp mod set
Parameters
modIds
Mods used for this set.
See Also
ModIOUnity.CreateTempModSet
ModIOUnityAsync.AddModsToTempModSet
ModIOUnity.DeleteTempModSet
ModIOUnity.RemoveModsFromTempModSet
ModIOUnity.GetTempSystemInstalledMods
ModId[] modIds;
void Example()
{
Result result = await ModIOUnity.CreateTempModSet(modIds);
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
AddModsToTempModSet
public static async Task<Result> AddModsToTempModSet(ModId[] modIds)
Adds mods to a Temp mod set
Parameters
modIds
Mods used for this set.
See Also
ModIOUnityAsync.CreateTempModSet
ModIOUnity.AddModsToTempModSet
ModIOUnity.DeleteTempModSet
ModIOUnity.RemoveModsFromTempModSet
ModIOUnity.GetTempSystemInstalledMods
ModId[] modIds;
void Example()
{
Result result = await ModIOUnity.AddModToTempModSet(modIds);
if (result.Succeeded())
{
Debug.Log("Successful");
}
else
{
Debug.Log("Failed");
}
}
ModIOUnityEvents
public static class ModIOUnityEvents
Method
TryGetCachedMod
public static bool TryGetCachedMod(ModId modId, out ModProfile modProfile)
RemoveModManagementEventDelegate
public static void RemoveModManagementEventDelegate(ModManagementEventDelegate modManagementEventDelegate)
ModId
[System.Serializable, TypeConverter(typeof(ModIdConverter))] public readonly struct ModId
A struct representing the globally unique identifier for a specific mod profile.
Field
ModId
Null
ModId Null = new ModId(0L)
long id
long id
Method
Equals
public bool Equals(ModId other)
Equals
public override bool Equals(object obj)
GetHashCode
public override int GetHashCode()
ToString
public override string ToString()
ModPage
[System.Serializable] public struct ModPage
A struct containing the ModProfiles and total number of remaining results that can be acquired with the SearchFilter used in the GetMods request.
See Also
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
Field
ModProfile
modProfiles
ModProfile[] modProfiles
The mod profiles retrieved from this pagination request
See Also
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
long totalSearchResultsFound
long totalSearchResultsFound
the total results that could be found. eg there may be a total of 1,000 mod profiles but this ModPage may only contain the first 100, depending on the SearchFilter pagination settings.
See Also
SearchFilter
SearchFilter.SetPageIndex
SearchFilter.SetPageSize
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
ModProfile
[Serializable] public readonly struct ModProfile
A struct representing all of the information available for a ModProfile.
See Also
ModIOUnity.GetMod
ModIOUnityAsync.GetMod
Field
ModId
id
ModId id
string tags
string[] tags
ModStatus
status
ModStatus status
bool visible
bool visible
string name
string name
string summary
string summary
string description
string description
string homePageUrl
string homePageUrl
string profilePageUrl
string profilePageUrl
MaturityOptions
maturityOptions
MaturityOptions maturityOptions
DateTime dateAdded
DateTime dateAdded
DateTime dateUpdated
DateTime dateUpdated
DateTime dateLive
DateTime dateLive
bool hasDependencies
bool hasDependencies
DownloadReference
galleryImagesOriginal
DownloadReference[] galleryImagesOriginal
DownloadReference
galleryImages320x180
DownloadReference[] galleryImages320x180
DownloadReference
galleryImages640x360
DownloadReference[] galleryImages640x360
DownloadReference
galleryImages1280x720
DownloadReference[] galleryImages1280x720
DownloadReference
logoImage320x180
DownloadReference logoImage320x180
DownloadReference
logoImage640x360
DownloadReference logoImage640x360
DownloadReference
logoImage1280x720
DownloadReference logoImage1280x720
DownloadReference
logoImageOriginal
DownloadReference logoImageOriginal
UserProfile
creator
UserProfile creator
DownloadReference
creatorAvatar50x50
DownloadReference creatorAvatar50x50
DownloadReference
creatorAvatar100x100
DownloadReference creatorAvatar100x100
DownloadReference
creatorAvatarOriginal
DownloadReference creatorAvatarOriginal
string platformStatus
string platformStatus
ModPlatform platforms
ModPlatform[] platforms
long gameId
long gameId
int communityOptions
int communityOptions
string nameId
string nameId
Modfile
modfile
Modfile modfile
RevenueType
revenueType
RevenueType revenueType
int price
int price
int tax
int tax
MonetizationOption
MonetizationOption
MonetizationOption MonetizationOption
int stock
int stock
string metadata
string metadata
The meta data for this mod, not to be confused with the meta data of the specific version
See Also
string latestVersion
string latestVersion
The most recent version of the mod that exists
string latestChangelog
string latestChangelog
the change log for the most recent version of this mod
DateTime latestDateFileAdded
DateTime latestDateFileAdded
the date for when the most recent mod file was uploaded
KeyValuePair<string, string> metadataKeyValuePairs
KeyValuePair<string, string>[] metadataKeyValuePairs
the KVP meta data for this mod profile. Not to be confused with the meta data blob or the meta data for the installed version of the mod
ModStats
stats
ModStats stats
long archiveFileSize
long archiveFileSize
ModProfileDetails
public class 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)
See Also
ModIOUnity.CreateModProfile
ModIOUnity.EditModProfile
Field
ModId?
modId
ModId? modId
Make sure to set this field when submitting a request to Edit a Mod Profile
Remarks
Can be null
bool? visible
bool? visible
Whether this mod will appear as public or hidden.
Remarks
Can be null
byte
logo
byte[] logo
Image file which will represent your mods logo. Must be gif, jpg or png format and cannot exceed 8MB in filesize. Dimensions must be at least 512x288 and we recommend you supply a high resolution image with a 16 / 9 ratio. mod.io will use this image to make three thumbnails for the dimensions 320x180, 640x360 and 1280x720
Remarks
Can be null if using EditModProfile
See Also
List images
List<byte[]> images
Image files that will be included in the mod profile details.
Remarks
Can be null
string imagesNames
string[] imagesNames
(Optional) If set, images
are named according to this array.
string name
string name
Name of your mod
Remarks
Can be null if using EditModProfile
See Also
string name_id
string name_id
Path for the mod on mod.io. For example: https://gamename.mod.io/mod-name-id-here.
If no name_id is specified the name
will be used. For example: 'Stellaris
Shader Mod' will become 'stellaris-shader-mod'. Cannot exceed 80 characters
Remarks
Can be null
string summary
string summary
Summary for your mod, giving a brief overview of what it's about. Cannot exceed 250 characters.
Remarks
This field must be assigned when submitting a new Mod Profile Can be null if using EditModProfile
See Also
string description
string description
Detailed description for your mod, which can include details such as 'About', 'Features', 'Install Instructions', 'FAQ', etc. HTML supported and encouraged
Remarks
Can be null
string homepage_url
string homepage_url
Official homepage for your mod. Must be a valid URL
Remarks
Can be null
int? stock
int? stock
This will create a cap on the number of subscribers for this mod. Set to 0 to allow for infinite subscribers.
Remarks
Can be null
MaturityOptions?
maturityOptions
MaturityOptions? maturityOptions
This is a Bitwise enum so you can assign multiple values
See Also
Remarks
Can be null
string metadata
string metadata
Your own custom metadata that can be uploaded with the mod profile. (This is for the entire mod profile, a unique metadata field can be assigned to each modfile as well)
See Also
Remarks
the metadata has a maximum size of 50,000 characters. Can be null
string tags
string[] tags
The tags this mod profile has. Only tags that are supported by the parent game can be
applied. An empty array will clear all tags, use null
for no change. (Invalid tags will be ignored)
Remarks
Can be null
CommunityOptions?
communityOptions
CommunityOptions? communityOptions = CommunityOptions.AllowCommenting
Select which interactions players can have with your mod. 0 = None 1 = Ability to comment (default) ? = Add the options you want together, to enable multiple options
Remarks
Can be null
int? price
int? price
The price of the mod NOTE: The value of this field will be ignored if the parent game's queue is enabled (see CurationOption in Game Object)
Remarks
Can be null
MonetizationOption?
monetizationOptions
MonetizationOption? monetizationOptions
Monetization options enabled by the mod creator.
You must set the team before setting monetization to live.
In order for a marketplace mod to go live both MonetizationOption.Enabled
and MonetizationOption.Live
need to be set.
NOTE: The value of this field will be ignored if the parent game's queue is enabled
(see CurationOption in Game Object)
Remarks
Can be null
ModStats
[System.Serializable] public struct ModStats
Detailed stats about a Mod's ratings, downloads, subscribers, popularity etc
Field
long modId
long modId
long popularityRankPosition
long popularityRankPosition
long popularityRankTotalMods
long popularityRankTotalMods
long downloadsToday
long downloadsToday
long downloadsTotal
long downloadsTotal
long subscriberTotal
long subscriberTotal
long ratingsTotal
long ratingsTotal
long ratingsPositive
long ratingsPositive
long ratingsNegative
long ratingsNegative
long ratingsPercentagePositive
long ratingsPercentagePositive
float ratingsWeightedAggregate
float ratingsWeightedAggregate
string ratingsDisplayText
string ratingsDisplayText
long dateExpires
long dateExpires
ModfileDetails
public class ModfileDetails
Field
ModId?
modId
ModId? modId
ModId of the mod that you wish to upload the modfile to. (Must be assigned)
string directory
string directory
The directory containing all of the files that makeup the mod. The directory and all of its contents will be compressed and uploaded when submitted via ModIOUnity.AddModfile.
string changelog
string changelog
the changelog for this file version of the mod.
string version
string version
The version number of this modfile as a string (eg 0.2.11)
string metadata
string metadata
Your own custom metadata that can be uploaded with the modfile.
Remarks
the metadata has a maximum size of 50,000 characters.
string uploadId
string uploadId = null
Required if the filedata parameter is omitted. The UUID of a completed multipart upload session.
bool active
bool active = true
Default value is true. Flag this upload as the current release, this will change the modfile field on the parent mod to the id of this file after upload.
string platforms
string[] platforms = null
If platform filtering enabled An array containing one or more platforms this file is targeting. Valid values can be found under the targeting a platform section.
MonetizationTeamAccount
[System.Serializable] public struct MonetizationTeamAccount
Field
long Id
long Id
string NameId
string NameId
string Username
string Username
int MonetizationStatus
int MonetizationStatus
int MonetizationOptions
int MonetizationOptions
int SplitPercentage
int SplitPercentage
MultipartUpload
[System.Serializable] public struct MultipartUpload
Field
string upload_id
string upload_id
A universally unique identifier (UUID) that represents the upload session.
int status
int status
The status of the upload session: 0 = Incomplete, 1 = Pending, 2 = Processing, 3 = Complete, 4 = Cancelled
MultipartUploadPart
[System.Serializable] public struct MultipartUploadPart
Field
string upload_id
string upload_id
A universally unique identifier (UUID) that represents the upload session.
int part_number
int part_number
The part number this object represents.
int part_size
int part_size
integer The size of this part in bytes.
int date_added
int date_added
integer Unix timestamp of date the part was uploaded.
ProgressHandle
public partial class 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.
Property
ModId
modId
public ModId modId
get
set
The ModId of the mod that this operation pertains to.
ModManagementOperationType
OperationType
public ModManagementOperationType OperationType
get
set
The type of operation being performed, eg. Download, Upload, Install
float Progress
public float Progress
get
set
The progress of the operation being performed, float range from 0.0f - 1.0f
long BytesPerSecond
public long BytesPerSecond
get
set
The average number of bytes being processed per second by the operation (Updated every 10 milliseconds)
Remarks
Only applicable to Download and Upload operations
bool Completed
public bool Completed
get
set
Is set to True when the operation has finished
Remarks
If an operation fails then Completed will still be True, therefore it is recommended to check Failed as well
bool Failed
public bool Failed
get
set
Is set to True if the operation encounters an error or is cancelled before completion
Method
UiHashCode
public int UiHashCode()
Rating
[Serializable] public struct Rating
A struct representing all of the information available for a Rating.
See Also
ModIOUnity.GetCurrentUserRatings
ModIOUnityAsync.GetCurrentUserRatings
RatingObject
Field
ModId
modId
ModId modId
ModRating
rating
ModRating rating
DateTime dateAdded
DateTime dateAdded
Report
public class Report
Used in conjunction with ModIOUnity.Report() to send a report to the mod.io server for a specific mod.
Field
long? id
long? id
string summary
string summary
ReportType?
type
ReportType? type
ReportResourceType? resourceType
ReportResourceType? resourceType
string user
string user
string contactEmail
string contactEmail
Method
CanSend
public bool CanSend()
Result
public struct Result
Struct returned from ModIO callbacks to inform the caller if the operation succeeded.
Property
string message
public string message
A string message explaining the result error code in more detail (If one exists).
string apiMessage
public string apiMessage
A string message explaining the result API error code in more detail (If one exists).
uint errorCode
public uint errorCode
The error code for the result. 0 = Success
uint apiCode
public uint apiCode
The API reference error code for the result. 0 = No API error
Method
Succeeded
public bool Succeeded()
IsCancelled
public bool IsCancelled()
IsInitializationError
public bool IsInitializationError()
IsAuthenticationError
public bool IsAuthenticationError()
IsInvalidSecurityCode
public bool IsInvalidSecurityCode()
IsInvalidEmailAddress
public bool IsInvalidEmailAddress()
IsPermissionError
public bool IsPermissionError()
IsNetworkError
public bool IsNetworkError()
Checks if the result failed due to no internet connection
Returns
true if the result failed due to no internet connection
IsStorageSpaceInsufficient
public bool IsStorageSpaceInsufficient()
IsRateLimited
public bool IsRateLimited()
ToString
public override string ToString()
ResultAnd
public class ResultAnd<T>
Convenience wrapper for essentially a Tuple.
Field
Result
result
Result result
T value
T value
SearchFilter
[Serializable] public class SearchFilter
Used to build a filter that is sent with requests for retrieving mods.
See Also
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
Property
RevenueType
RevenueType
public RevenueType RevenueType
get
set
Choose if the filter should include/exclude free or paid mods.
Parameters
type
IEnumerable GetTags
public IEnumerable<string> GetTags
SortModsBy
SortBy
public SortModsBy SortBy
Method
ShowSoldOut
public void ShowSoldOut()
The search will now show sold out mods
DontShowSoldOut
public void DontShowSoldOut()
The search will now not show sold out mods
ShowMatureContent
public void ShowMatureContent(bool value)
GetShowMatureContent
public bool GetShowMatureContent()
AddSearchPhrase
public void AddSearchPhrase(string phrase, FilterType filterType
Adds a phrase into the filter to be used when filtering mods in a request.
Parameters
phrase
the string to be added to the filter
filterType
(Optional) type of filter to be used with the text, defaults to Full text search
ClearSearchPhrases
public void ClearSearchPhrases()
ClearSearchPhrases
public void ClearSearchPhrases(FilterType filterType)
GetSearchPhrase
public string[] GetSearchPhrase(FilterType filterType)
AddTag
public void AddTag(string tag)
Adds a tag to be used in filtering mods for a request.
Parameters
tag
the tag to be added to the filter
See Also
AddTags
public void AddTags(IEnumerable<string> tags)
Adds multiple tags used in filtering mods for a request.
Parameters
tags
the tags to be added to the filter
See Also
ClearTags
public void ClearTags()
SetSortBy
public void SetSortBy(SortModsBy category)
Determines what category mods should be sorted and returned by. eg if the category SortModsBy.Downloads was used, then the results would be returned by the number of downloads. Depending on the Ascending or Descending setting, it will start or end with mods that have the highest or lowest number of downloads.
Parameters
category
the category to sort the request
See Also
SetToAscending
public void SetToAscending(bool isAscending)
Determines the order of the results being returned. eg should results be filtered from highest to lowest, or lowest to highest.
Parameters
isAscending
SetPageIndex
public void SetPageIndex(int pageIndex)
The search will skip pageIndex * pageSize
results and return (up to) the following results.
See Also
SetPageSize
public void SetPageSize(int pageSize)
Limit the number of results returned (100 max).
Use SetPageIndex
to skip results and return later results.
See Also
AddUser
public void AddUser(long userId)
Adds a specific user to the filter, so that mods that were not created by the user (or other users added to the filter) will not be returned.
Parameters
userId
Id of the user to add
See Also
GetUserIds
public IReadOnlyList<long> GetUserIds()
AddPlatformStatus
public void AddPlatformStatus(SearchFilterPlatformStatus status)
Adds a specific platform status to the filter to show mods that are either pending or both pending and live. This is primarily to be used in QA of mods.
Parameters
status
Platform verified status to show mods of
IsSearchFilterValid
public bool IsSearchFilterValid(out Result result)
You can use this method to check if a search filter is setup correctly before using it in a GetMods request.
Parameters
result
Returns
true if the filter is valid
See Also
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
GetPageIndex
public int GetPageIndex()
Use this method to fetch the page index
Returns
Returns the current value of the page index
GetPageSize
public int GetPageSize()
Use this method to fetch the page size
Returns
Returns the current value of the page size
ServerSettings
[System.Serializable] public struct 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
See Also
BuildSettings
ModIOUnity.InitializeForUser
ModIOUnityAsync.InitializeForUser
Field
string serverURL
string serverURL
URL for the mod.io server to connect to.
uint gameId
uint gameId
Game Id as can be found on mod.io Web UI.
string gameKey
string gameKey
mod.io Service API Key used by your game to connect.
string languageCode
string languageCode
Language code for the localizing message responses. See https://docs.mod.io/restapiref/#localization for possible values.
bool disableUploads
bool disableUploads
Disables uploading mods and modfiles for this build.
bool useCommandLineArgumentOverrides
bool useCommandLineArgumentOverrides
Enables the use of command line arguments to override server settings.
bool fallbackToEmailAuth
bool fallbackToEmailAuth
SubscribedMod
public struct 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.
Remarks
Note this is not necessarily an installed mod. You will need to check the status to see whether or not it is installed.
See Also
status
SubscribedModStatus
ModProfile
ModIOUnity.GetSubscribedMods
Field
SubscribedModStatus
status
SubscribedModStatus status
string directory
string directory
ModProfile
modProfile
ModProfile modProfile
bool enabled
bool enabled
Whether the mod has been marked as enabled or disabled by the user
See Also
ModIOUnity.EnableMod
ModIOUnity.DisableMod
SubscribedModStatusExtensions
public static class SubscribedModStatusExtensions
Method
IsSubscribed
public static bool IsSubscribed(this SubscribedModStatus value)
Tag
[System.Serializable] public struct Tag
Represents a Tag that can be assigned to a mod.
See Also
TagCategory
ModIOUnity.GetTagCategories
ModIOUnityAsync.GetTagCategories
Field
string name
string name
int totalUses
int totalUses
TagCategory
[System.Serializable] public struct TagCategory
Represents a particular category of tags.
See Also
ModIOUnity.GetTagCategories
ModIOUnityAsync.GetTagCategories
Tag
Field
string name
string name
Dictionary nameLocalized
Dictionary<string, string> nameLocalized
Localized category name, keyed by language code.
Tag
tags
Tag[] tags
Dictionary<string, string> tagsLocalized
Dictionary<string, string>[] tagsLocalized
Localized tags, keyed by language code.
Order matches tags
, however English value is also available using tagsLocalized["en"]
.
See Also
ModIOUnity.GetTagLocalized(string)
ModIOUnity.GetTagLocalized(string, string)
bool multiSelect
bool multiSelect
bool hidden
bool hidden
bool locked
bool locked
TermsHash
[Serializable] public struct TermsHash
This is the hash that identifies the TOS. Used to validate the TOS requirement when attempting to authenticate a user.
See Also
TermsOfUse
ModIOUnity.GetTermsOfUse
ModIOUnityAsync.GetTermsOfUse
Field
string md5hash
string md5hash
TermsOfUse
[System.Serializable] public struct 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.
See Also
ModIOUnity.GetTermsOfUse
ModIOUnityAsync.GetTermsOfUse
ModIOUnity.AuthenticateUserViaDiscord
ModIOUnity.AuthenticateUserViaGoogle
ModIOUnity.AuthenticateUserViaGOG
ModIOUnity.AuthenticateUserViaItch
ModIOUnity.AuthenticateUserViaOculus
ModIOUnity.AuthenticateUserViaSteam
ModIOUnity.AuthenticateUserViaSwitch
ModIOUnity.AuthenticateUserViaXbox
Field
string termsOfUse
string termsOfUse
string agreeText
string agreeText
string disagreeText
string disagreeText
TermsOfUseLink
links
TermsOfUseLink[] links
TermsHash
hash
TermsHash hash
TermsOfUseLink
[Serializable] public struct 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.
Field
string apiName
string apiName
string name
string name
string url
string url
bool required
bool required
TokenPack
public struct TokenPack
Field
long id
long id
string name
string name
string description
string description
long price
long price
long amount
long amount
Portal
portals
Portal[] portals
Struct
Portal
id
portal
sku
Enums
UISettings
[System.Serializable] public struct UISettings
Field
bool ShowMonetizationUI
bool ShowMonetizationUI
bool ShowEnabledModToggle
bool ShowEnabledModToggle
UserInstalledMod
public struct 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.
Field
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
UserProfile
[System.Serializable] public struct UserProfile
Represents a particular mod.io user with their username, DownloadReferences for getting their avatar, as well as their language and timezone.
Field
string username
string username
The display name of the user's mod.io account
long userId
long userId
This is the unique Id of the user.
string portal_username
string portal_username
The display name of the user's account they authenticated with. Eg if they authenticated with Steam it would be their Steam username.
DownloadReference
avatar_original
DownloadReference avatar_original
DownloadReference
avatar_50x50
DownloadReference avatar_50x50
DownloadReference
avatar_100x100
DownloadReference avatar_100x100
string timezone
string timezone
string language
string language
Wallet
public class Wallet
A struct representing the user's wallet and current balance.
See Also
ModIOUnity.GetUserWalletBalance
ModIOUnityAsync.GetUserWalletBalance
;
Field
string type
string type
string currency
string currency
int balance
int balance
Enums
AuthenticationServiceProvider
Steam
Epic
GOG
Itchio
Oculus
Xbox
Switch
Discord
Google
PlayStation
OpenId
AppleId
None
AvatarSize
Original
Thumbnail_50x50
Thumbnail_100x100
CommunityOptions
None = 0x00
AllowCommenting = 0x01
FilterType
Type of search to be used in the SearchFilter
See Also
FullTextSearch
NotEqualTo
Like
NotLike
In
NotIn
Max
Min
BitwiseAnd
GameMonetizationOptions
All = 0b0000
Enabled = 0b0001
EnableMarketplace = 0b0010
EnablePartnerProgram = 0b0100
EnableScarcity = 0b1000
LogLevel
The logging level of the plugin. Used in BuildSettings to determine which log messages to ignore or display.
None = -1
Error = 0
Warning = 1
Message = 2
Verbose = 3
MaturityOptions
None = 0b0000
Alcohol = 0b0001
Drugs = 0b0010
Violence = 0b0100
Explicit = 0b1000
ModManagementEventType
InstallStarted
Installed
InstallFailed
DownloadStarted
Downloaded
DownloadFailed
UninstallStarted
Uninstalled
UninstallFailed
UpdateStarted
Updated
UpdateFailed
ModManagementOperationType
None_AlreadyInstalled
None_ErrorOcurred
Install
Download
Uninstall
Update
Upload
ModRating
Positive = 1
Negative = -1
None = 0
ModStatus
Accepted = 0
NotAccepted = 1
Deleted = 3
MonetizationOption
Monetization options enabled by the creator. Multiple options can be combined.
See Also
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
None = 0
Enabled = 1
Live = 2
EnablePartnerProgram = 4
EnableScarcity = 8
OculusDevice
Rift
Quest
PlayStationEnvironment
spint = 1
prodqa = 8
np = 256
ReportType
Generic = 0
DMCA = 1
NotWorking = 2
RudeContent = 3
IllegalContent = 4
StolenContent = 5
FalseInformation = 6
Other = 7
RevenueType
Finds all mods with or without a price. Default is Free.
See Also
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
Free = 0
Paid = 1
FreeAndPaid = 2
SearchFilterPlatformStatus
PendingOnly = 1
LiveAndPending = 2
SortModsBy
Category to be used in the SearchFilter for determining how mods should be filtered in a request.
See Also
SearchFilter
ModIOUnity.GetMods
ModIOUnityAsync.GetMods
Name
Price
Rating
Popular
Downloads
Subscribers
DateSubmitted
SubscribedModStatus
The current state of a subscribed mod. Useful for checking whether or not a mod has been installed yet or if there was a problem trying to download/install it.
See Also
Installed
WaitingToDownload
WaitingToInstall
WaitingToUpdate
WaitingToUninstall
Downloading
Installing
Uninstalling
Updating
ProblemOccurred
None
UserPortal
Values representing the valid User Portals that mod.io works with. Used when setting up BuildSettings.
See Also
None = 0
Apple
Discord
EpicGamesStore
GOG
Google
itchio
Nintendo
Oculus
PlayStationNetwork
Steam
XboxLive
ModIO.Implementation.API.Objects
Type | Name | Description |
---|---|---|
CheckoutProcess | CheckoutProcess | |
Error | Error |
CheckoutProcess
public struct CheckoutProcess
Field
int transactionId
int transactionId
string grossAmount
string grossAmount
string platformFee
string platformFee
string tax
string tax
long purchaseDate
long purchaseDate
int netAmount
int netAmount
int gatewayFee
int gatewayFee
string transactionType
string transactionType
object meta
object meta
string walletType
string walletType
int balance
int balance
int deficit
int deficit
string paymentMethodId
string paymentMethodId
ModProfile
modProfile
ModProfile modProfile
Error
[System.Serializable] public struct Error
Field
long code
long code
long error_ref
long error_ref
string message
string message
Dictionary errors
Dictionary<string, string> errors
Enums
ModIO.Util
Type | Name | Description |
---|---|---|
DownloadModToStreamOperation | DownloadModToStreamOperation | |
EnumExtensions | EnumExtensions | |
ModioMainThreadHelper | ModioMainThreadHelper | A slightly more robust and static friendly version of MonoDispatcher |
MonoDispatcher | MonoDispatcher | |
MonoSingleton | MonoSingleton | |
SelfInstancingMonoSingleton | SelfInstancingMonoSingleton | |
SimpleMessageHub | SimpleMessageHub | |
SimpleMessageUnsubscribeToken | SimpleMessageUnsubscribeToken | |
SimplePool | SimplePool | |
SimpleSingleton | SimpleSingleton | |
Utility | Utility |
DownloadModToStreamOperation
public class DownloadModToStreamOperation : IDisposable
Field
ModId
modId
ModId modId
Stream
archiveStream
Stream archiveStream
bool closeStream
bool closeStream
Task
task
Task task
Property
OperationStatus
Status
public OperationStatus Status
get
set
bool IsDownloading
public bool IsDownloading
bool IsCompleted
public bool IsCompleted
bool IsCancelled
public bool IsCancelled
bool IsSucceeded
public bool IsSucceeded
bool IsFailed
public bool IsFailed
float DownloadProgress
public float DownloadProgress
get
set
string FailedMessage
public string FailedMessage
get
set
Method
Cancel
public void Cancel()
GetFiles
public IEnumerable<ArchiveStreamFile> GetFiles()
Returns a new array of all file entries in the archive. Use for extracting files.
ExtractFileToStream
public async Task ExtractFileToStream(ArchiveStreamFile file, Stream result, bool removeFromArchive
Extracts a file from the archive and optionally removes it.
Use GetFiles
to get a list of files in the archive.
ExtractFileToStream
public async Task ExtractFileToStream(string path, Stream result, bool removeFromArchive
Extracts a file from the archive and optionally removes it.
Use GetFiles
to get a list of files in the archive.
Dispose
public void Dispose()
Struct
ArchiveStreamFile
fileName
path
sizeCompressed
sizeUncompressed
Enums
Enum
RequestingModInfo
Downloading
Verifying
ProcessingArchive
Cancelled
Succeeded
Failed
EnumExtensions
public static class EnumExtensions
Method
ExtractBitFlagsFromEnum
public static IEnumerable<string> ExtractBitFlagsFromEnum<T>(this T value) where T : Enum
ModioMainThreadHelper
public class ModioMainThreadHelper : MonoBehaviour
A slightly more robust and static friendly version of MonoDispatcher
Method
Run
public static void Run(Action runOnMainThread)
The action will be called immediately if we're already on the Unity thread,
Parameters
runOnMainThread
EnsureInstance
public static void EnsureInstance()
Call this from the main thread before calling Run(action) later You could alternately put an instance in the scene yourself
MonoDispatcher
public class MonoDispatcher : SelfInstancingMonoSingleton<MonoDispatcher>
Method
MainThread
public bool MainThread()
Run
public void Run(Action action)
MonoSingleton
public class MonoSingleton<T> : MonoBehaviour, ISimpleMonoSingleton where T : MonoBehaviour
Property
bool HasInstance
public static bool HasInstance
T Instance
public static T Instance
get
set
Method
SetupSingleton
public void SetupSingleton()
SingletonIsInstantiated
public static bool SingletonIsInstantiated()
SelfInstancingMonoSingleton
public class SelfInstancingMonoSingleton<T> : MonoBehaviour, ISimpleMonoSingleton where T : MonoBehaviour
Property
T Instance
public static T Instance
get
set
Method
SetupSingleton
public void SetupSingleton()
SingletonIsInstantiated
public static bool SingletonIsInstantiated()
SimpleMessageHub
public class SimpleMessageHub : SelfInstancingMonoSingleton<SimpleMessageHub>
Method
Subscribe
public SimpleMessageUnsubscribeToken Subscribe<T>(Action<T> subscription) where T : class, ISimpleMessage
Publish
public void Publish<T>(T message) where T : class, ISimpleMessage
PublishThreadSafe
public void PublishThreadSafe<T>(T message) where T : class, ISimpleMessage
ClearSubscriptionType
public void ClearSubscriptionType<T>()
SimpleMessageUnsubscribeToken
public class SimpleMessageUnsubscribeToken
Method
Unsubscribe
public void Unsubscribe()
SimplePool
public class SimplePool : SelfInstancingMonoSingleton<SimplePool>
Field
Dictionary pool
Dictionary<string, List<MonoBehaviour>> pool = new Dictionary<string, List<MonoBehaviour>>()
Method
Get
public T Get<T>(string name, Func<T> constructor) where T : MonoBehaviour
Return
public void Return<T>(string id, T item) where T : MonoBehaviour
PrePool
public void PrePool<T>(string name, Func<T> constructor, int num) where T : MonoBehaviour
SimpleSingleton
public class SimpleSingleton<T> where T : new()
Property
T Instance
public static T Instance
get
set
Method
Instantiate
public void Instantiate()
Utility
public static class Utility
Method
GenerateHumanReadableNumber
public static string GenerateHumanReadableNumber(long number)
changes an int64 number into something more human readable such as "12.6K"
Parameters
number
the long to convert to readable string
Returns
GenerateHumanReadableTimeStringFromSeconds
public static string GenerateHumanReadableTimeStringFromSeconds(int seconds)
GenerateHumanReadableStringForBytes
public static string GenerateHumanReadableStringForBytes(long bytes)
GetModStatusAsString
public static string GetModStatusAsString(ProgressHandle handle)
GetModStatusAsString
public static string GetModStatusAsString(SubscribedMod mod)
EncodeEncryptedSteamAppTicket
public static string EncodeEncryptedSteamAppTicket(byte[] ticketData, uint ticketSize)
You can use this to convert your byte[] steam app ticket into a trimmed base64 encoded string to be used for the steam authentication.
Parameters
ticketData
the byte[] steam app ticket data
ticketSize
the desired length of the ticket to be trimmed to
See Also
SetupSteamAuthenticationOption
Returns
base 64 encoded string from the provided steam app ticket
FindEverythingInScene
public static List<T> FindEverythingInScene<T>() where T : Component
Finds everything in a loaded scene. Slow.
ForceSetPlatformHeader
public static void ForceSetPlatformHeader(RestApiPlatform platform)
Overrides the current platform setting in rest api calls
Parameters
platform
new rest api platform
DownloadModToStream
public static DownloadModToStreamOperation DownloadModToStream(ModId modId, Stream archiveStream, bool closeStream
Downloads a mod's file archive into archiveStream
.
Use the returned DownloadModToStreamOperation
to track status and extract files.
Parameters
modId
The id of the mod to download.
archiveStream
The stream the compressed archive will be downloaded into.
closeStream
Should the operation close archiveStream
when it is disposed?
Returns
Operation handle to access status and results.
async void DownloadModToMemory(ModId modId)
{
using MemoryStream archiveStream = new MemoryStream();
See Also
DownloadModToStreamOperation.GetFiles
DownloadModToStreamOperation.ArchiveStreamFile
DownloadModToStreamOperation.ExtractFileToStream(DownloadModToStreamOperation.ArchiveStreamFile, Stream, bool)