Unity v2 Plugin 0.1
mod management for Unity projects
ModIO.ModIOUnityAsync Class Reference

Static Public Member Functions

static async Task< ResultInitializeForUser (string userProfileIdentifier, ServerSettings serverSettings, BuildSettings buildSettings)
 Initializes the Plugin using the provided settings for a specified user. Loads the local state of mods installed on the system as well as relevant mods to the user. Loads the state of mods installed on the system as well as the set of mods the specified user has installed on this device. More...
 
static async Task< ResultInitializeForUser (string userProfileIdentifier)
 Initializes the Plugin using the provided settings for a specified user. Loads the local state of mods installed on the system as well as relevant mods to the user. Loads the state of mods installed on the system as well as the set of mods the specified user has installed on this device. More...
 
static async Task Shutdown ()
 Cancels any running public operations, frees plugin resources, and invokes any pending callbacks with a cancelled result code. More...
 
static async Task< ResultRequestAuthenticationEmail (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() More...
 
static async Task< ResultSubmitEmailSecurityCode (string securityCode)
 Attempts to Authenticate the current session by submitting a security code received by email from ModIOUnity.RequestAuthenticationEmail() More...
 
static async Task< ResultAnd< TermsOfUse > > GetTermsOfUse ()
 
static async Task< ResultAuthenticateUserViaSteam (string steamToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the steam API. More...
 
static async Task< ResultAuthenticateUserViaGOG (string gogToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the GOG API. More...
 
static async Task< ResultAuthenticateUserViaItch (string itchioToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the Itch.io API. More...
 
static async Task< ResultAuthenticateUserViaXbox (string xboxToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the Xbox API. More...
 
static async Task< ResultAuthenticateUserViaSwitch (string switchToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the switch API. More...
 
static async Task< ResultAuthenticateUserViaDiscord (string discordToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the discord API. More...
 
static async Task< ResultAuthenticateUserViaGoogle (string googleToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the google API. More...
 
static async Task< ResultAuthenticateUserViaOculus (OculusDevice oculusDevice, string nonce, long userId, string oculusToken, [CanBeNull] string emailAddress, [CanBeNull] TermsHash? hash)
 Attempts to authenticate a user via the oculus API. More...
 
static async Task< ResultIsAuthenticated ()
 Informs you if the current user session is authenticated or not. More...
 
static async Task< ResultAnd< TagCategory[]> > GetTagCategories ()
 Gets the existing tags for the current game Id that can be used when searching/filtering mods. More...
 
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. More...
 
static async Task< ResultAnd< ModProfile > > GetMod (ModId modId)
 Requests a single ModProfile from the mod.io server by its ModId. More...
 
static async Task< ResultRateMod (ModId modId, ModRating rating)
 Used to submit a rating for a specified mod. More...
 
static async Task< ResultSubscribeToMod (ModId modId)
 Adds the specified mod to the current user's subscriptions. More...
 
static async Task< ResultUnsubscribeFromMod (ModId modId)
 Removes the specified mod from the current user's subscriptions. More...
 
static async Task< ResultAnd< UserProfile > > GetCurrentUser ()
 Gets the current user's UserProfile struct. Containing their mod.io username, user id, language, timezone and download references for their avatar. More...
 
static async Task< ResultFetchUpdates ()
 This retrieves the user's subscriptions from the mod.io server and synchronises it with our local instance of the user's subscription data. If mod management has been enabled via ModIOUnity.EnableModManagement() then it may begin to install/uninstall mods. More...
 
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. More...
 
static async Task< ResultEditModProfile (ModProfileDetails modprofile)
 This is used to edit or change data in an existing mod profile on the mod.io server. More...
 
static async Task< ResultUploadModfile (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). More...
 
static async Task< ResultArchiveModProfile (ModId modId)
 Removes a mod from being visible on the mod.io server. More...
 
static async Task< ResultAnd< ModProfile[]> > GetCurrentUserCreations ()
 Not implemented yet
 
static async Task< ResultAnd< Texture2D > > DownloadTexture (DownloadReference downloadReference)
 Downloads a texture based on the specified download reference. More...
 
static async Task< ResultReport (Report report)
 Reports a specified mod to mod.io. More...
 

Member Function Documentation

◆ ArchiveModProfile()

static async Task< Result > ModIO.ModIOUnityAsync.ArchiveModProfile ( ModId  modId)
static

Removes a mod from being visible on the mod.io server.

If you want to delete a mod permanently you can do so from a web browser.

Parameters
modIdthe id of the mod to delete
See also
Result, CreateModProfile, EditModProfile
ModId modId;
void async Example()
{
Result result = await ModIOUnityAsync.ArchiveModProfile(modId);
if (result.Succeeded())
{
Debug.Log("archived mod profile");
}
else
{
Debug.Log("failed to archive mod profile");
}
}

◆ AuthenticateUserViaDiscord()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaDiscord ( string  discordToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the discord API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ AuthenticateUserViaGOG()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaGOG ( string  gogToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the GOG API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ AuthenticateUserViaGoogle()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaGoogle ( string  googleToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the google API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async Authenticate_Example()
{
Result result = await ModIOUnityAsync.AuthenticateUserViaGoogle(googleToken, "johndoe@gmail.com", modIOTermsOfUse.hash);
if (result.Succeeded())
{
Debug.Log("Successfully authenticated user");
}
else
{
Debug.Log("Failed to authenticate");
}
}

◆ AuthenticateUserViaItch()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaItch ( string  itchioToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the Itch.io API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ AuthenticateUserViaOculus()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaOculus ( OculusDevice  oculusDevice,
string  nonce,
long  userId,
string  oculusToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the oculus API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ AuthenticateUserViaSteam()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaSteam ( string  steamToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the steam API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ AuthenticateUserViaSwitch()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaSwitch ( string  switchToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the switch API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ AuthenticateUserViaXbox()

static async Task< Result > ModIO.ModIOUnityAsync.AuthenticateUserViaXbox ( string  xboxToken,
[CanBeNull] string  emailAddress,
[CanBeNull] TermsHash hash 
)
static

Attempts to authenticate a user via the Xbox API.

You will first need to get the terms of use and hash from the ModIOUnity.GetTermsOfUse() method.

Parameters
steamTokenthe user's steam token
emailAddressthe user's email address
hashthe TermsHash retrieved from ModIOUnity.GetTermsOfUse()
See also
GetTermsOfUse
// First we get the Terms of Use to display to the user and cache the hash
void async GetTermsOfUse_Example()
{
ResultAnd&#60;TermsOfUser&#62; 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
void async 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");
}
}

◆ CreateModProfile()

static async Task< ResultAnd< ModId > > ModIO.ModIOUnityAsync.CreateModProfile ( CreationToken  token,
ModProfileDetails  modProfileDetails 
)
static

Creates a new mod profile on the mod.io server based on the details provided from the ModProfileDetails object provided.

Note that this will create a new profile on the server and can be viewed online through a browser.

Parameters
tokenthe token allowing a new unique profile to be created from ModIOUnity.GenerateCreationToken()
modProfileDetailsthe mod profile details to apply to the mod profile being created
See also
GenerateCreationToken, CreationToken, ModProfileDetails, Result, ModId
ModId newMod;
CreationToken token;
void async Example()
{
token = ModIOUnity.GenerateCreationToken();
ModProfileDetails profile = new ModProfileDetails();
profile.name = "mod name";
profile.summary = "a brief summary about this mod being submitted"
ResultAnd&#60;ModId&#62; 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");
}
}

◆ DownloadTexture()

static async Task< ResultAnd< Texture2D > > ModIO.ModIOUnityAsync.DownloadTexture ( DownloadReference  downloadReference)
static

Downloads a texture based on the specified download reference.

You can get download references from UserProfiles and ModProfiles

Parameters
downloadReferencedownload reference for the texture (eg UserObject.avatar_100x100)
See also
Result, DownloadReference, Texture2D
ModProfile mod;
void async Example()
{
ResultAnd&#60;Texture2D&#62; 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");
}
}

◆ EditModProfile()

static async Task< Result > ModIO.ModIOUnityAsync.EditModProfile ( ModProfileDetails  modprofile)
static

This is used to edit or change data in an existing mod profile on the mod.io server.

You need to assign the ModId of the mod you want to edit inside of the ModProfileDetails object included in the parameters

Parameters
modProfilethe mod profile details to apply to the mod profile being created
See also
ModProfileDetails, Result
ModId modId;
void async Example()
{
ModProfileDetails profile = new ModProfileDetails();
profile.id = 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");
}
}

◆ FetchUpdates()

static async Task< Result > ModIO.ModIOUnityAsync.FetchUpdates ( )
static

This retrieves the user's subscriptions from the mod.io server and synchronises it with our local instance of the user's subscription data. If mod management has been enabled via ModIOUnity.EnableModManagement() then it may begin to install/uninstall mods.

This requires the current session to have an authenticated user, otherwise Result.IsAuthenticationError() from the Result will equal true.

See also
Result, EnableModManagement(ModIO.ModManagementEventDelegate), IsAuthenticated, RequestAuthenticationEmail, SubmitEmailSecurityCode, AuthenticateUserViaDiscord, AuthenticateUserViaGoogle, AuthenticateUserViaGOG, AuthenticateUserViaItch, AuthenticateUserViaOculus, AuthenticateUserViaSteam, AuthenticateUserViaSwitch, AuthenticateUserViaXbox
void async Example()
{
Result result = await ModIOUnityAsync.FetchUpdates();
if (result.Succeeded())
{
Debug.Log("updated user subscriptions");
}
else
{
Debug.Log("failed to get user subscriptions");
}
}

◆ GetCurrentUser()

static async Task< ResultAnd< UserProfile > > ModIO.ModIOUnityAsync.GetCurrentUser ( )
static

Gets the current user's UserProfile struct. Containing their mod.io username, user id, language, timezone and download references for their avatar.

This requires the current session to have an authenticated user, otherwise Result.IsAuthenticationError() from the Result will equal true.

See also
Result, UserProfile, IsAuthenticated
void async Example()
{
ResultAnd&#60;UserProfile&#62; response = await ModIOUnityAsync.GetCurrentUser();
if (response.result.Succeeded())
{
Debug.Log("Got user: " + response.value.username);
}
else
{
Debug.Log("failed to get user");
}
}

◆ GetMod()

static async Task< ResultAnd< ModProfile > > ModIO.ModIOUnityAsync.GetMod ( ModId  modId)
static

Requests a single ModProfile from the mod.io server by its ModId.

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
modIdthe ModId of the ModProfile to get
See also
ModId, ModProfile, Result
void async Example()
{
ModId modId = new ModId(1234);
ResultAnd&#60;ModProfile&#62; response = await ModIOUnityAsync.GetMod(modId);
if (response.result.Succeeded())
{
Debug.Log("retrieved mod " + response.value.name);
}
else
{
Debug.Log("failed to get mod");
}
}

◆ GetMods()

static async Task< ResultAnd< ModPage > > ModIO.ModIOUnityAsync.GetMods ( SearchFilter  filter)
static

Uses a SearchFilter to retrieve a specific Mod Page and returns the ModProfiles and total number of mods based on the Search Filter.

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
filterThe filter to apply when searching through mods (also contains pagination parameters)
See also
SearchFilter, ModPage, Result
void async Example()
{
SearchFilter filter = new SearchFilter();
filter.SetPageIndex(0);
filter.SetPageSize(10);
ResultAnd&#60;ModPage&#62; response = await ModIOUnityAsync.GetMods(filter);
if (response.result.Succeeded())
{
Debug.Log("ModPage has " + response.value.mods.Length + " mods");
}
else
{
Debug.Log("failed to get mods");
}
}

◆ GetTagCategories()

static async Task< ResultAnd< TagCategory[]> > ModIO.ModIOUnityAsync.GetTagCategories ( )
static

Gets the existing tags for the current game Id that can be used when searching/filtering mods.

Tags come in category groups, eg "Color" could be the name of the category and the tags themselves could be { "Red", "Blue", "Green" }

See also
SearchFilter, TagCategory, Result
void async Example()
{
ResultAnd&#60;TagCategory[]&#62; 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");
}
}

◆ GetTermsOfUse()

static async Task< ResultAnd< TermsOfUse > > ModIO.ModIOUnityAsync.GetTermsOfUse ( )
static

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.

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()

Parameters
serviceProviderThe provider you intend to use for authentication, eg steam, google etc. (You dont need to display terms of use to the user if they are authenticating via email security code)
See also
TermsOfUse, AuthenticateUserViaDiscord, AuthenticateUserViaGoogle, AuthenticateUserViaGOG, AuthenticateUserViaItch, AuthenticateUserViaOculus, AuthenticateUserViaSteam, AuthenticateUserViaSwitch, AuthenticateUserViaXbox
void async Example()
{
ResultAnd&#60;TermsOfUser&#62; 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");
}
}

◆ InitializeForUser() [1/2]

static async Task< Result > ModIO.ModIOUnityAsync.InitializeForUser ( string  userProfileIdentifier)
static

Initializes the Plugin using the provided settings for a specified user. Loads the local state of mods installed on the system as well as relevant mods to the user. Loads the state of mods installed on the system as well as the set of mods the specified user has installed on this device.

Parameters
userProfileIdentifierName of the directory to store the user's data in.
See also
Result, Shutdown
void async Example()
{
Result result = await ModIOUnityAsync.InitializeForUserAsync("ExampleUser");
if (result.Succeeded())
{
Debug.Log("Initialized plugin");
}
else
{
Debug.Log("Failed to initialize plugin");
{
}

◆ InitializeForUser() [2/2]

static async Task< Result > ModIO.ModIOUnityAsync.InitializeForUser ( string  userProfileIdentifier,
ServerSettings  serverSettings,
BuildSettings  buildSettings 
)
static

Initializes the Plugin using the provided settings for a specified user. Loads the local state of mods installed on the system as well as relevant mods to the user. Loads the state of mods installed on the system as well as the set of mods the specified user has installed on this device.

Parameters
userProfileIdentifierName of the directory to store the user's data in.
serverSettingsData used by the plugin to connect with the mod.io service.
buildSettingsData used by the plugin to interact with the platform.
See also
FetchUpdates, ServerSettings, BuildSettings, Result, Shutdown
void async Example()
{
// Setup a ServerSettings struct
ServerSettings serverSettings = new ServerSettings();
serverSettings.serverURL = "https://api.test.mod.io/v1";
serverSettings.gameId = 1234;
serverSettings.gameKey = "1234567890abcdefghijklmnop";
// Setup a BuildSettings struct
BuildSettings buildSettings = new BuildSettings();
buildSettings.LogLevel = LogLevel.Verbose;
buildSettings.UserPortal = UserPortal.None;
buildSettings.requestCacheLimitKB = 0; // No limit
Result result = await ModIOUnityAsync.InitializeForUserAsync("ExampleUser", serverSettings, buildSettings);
if (result.Succeeded())
{
Debug.Log("Initialized plugin");
}
else
{
Debug.Log("Failed to initialize plugin");
{
}
UserPortal
Values representing the valid User Portals that mod.io works with.
Definition: UserPortal.cs:5

◆ IsAuthenticated()

static async Task< Result > ModIO.ModIOUnityAsync.IsAuthenticated ( )
static

Informs you if the current user session is authenticated or not.

See also
Result
void async Example()
{
Result result = await ModIOUnityAsync.IsAuthenticated();
if (result.Succeeded())
{
Debug.Log("current session is authenticated");
}
else
{
Debug.Log("current session is not authenticated");
}
}

◆ RateMod()

static async Task< Result > ModIO.ModIOUnityAsync.RateMod ( ModId  modId,
ModRating  rating 
)
static

Used to submit a rating for a specified mod.

This can be used to change/overwrite previous ratings of the current user.

Parameters
modIdthe m=ModId of the mod being rated
ratingthe rating to give the mod. Allowed values include ModRating.Positive, ModRating.Negative, ModRating.None
See also
ModRating, Result, ModId
ModProfile mod;
void async 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");
{
}

◆ Report()

static async Task< Result > ModIO.ModIOUnityAsync.Report ( Report  report)
static

Reports a specified mod to mod.io.

Parameters
reportthe object containing all of the details of the report you are sending
See also
Report, Result
void async 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");
}
}
static async Task< Result > Report(Report report)
Reports a specified mod to mod.io.
Definition: ModIOUnityAsync.cs:1212

◆ RequestAuthenticationEmail()

static async Task< Result > ModIO.ModIOUnityAsync.RequestAuthenticationEmail ( string  emailaddress)
static

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()

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
emailaddressthe Email Address to send the security code to, eg "JohnDoe@gmail.com"
See also
SubmitEmailSecurityCode, Result
void async 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");
}
}

◆ Shutdown()

static async Task ModIO.ModIOUnityAsync.Shutdown ( )
static

Cancels any running public operations, frees plugin resources, and invokes any pending callbacks with a cancelled result code.

pending operations during a shutdown can be checked with Result.IsCancelled()

See also
Result
void async Example()
{
await ModIOUnityAsync.Shutdown();
Debug.Log("Finished shutting down the ModIO Plugin");
}

◆ SubmitEmailSecurityCode()

static async Task< Result > ModIO.ModIOUnityAsync.SubmitEmailSecurityCode ( string  securityCode)
static

Attempts to Authenticate the current session by submitting a security code received by email from ModIOUnity.RequestAuthenticationEmail()

It is intended that this function is used after ModIOUnity.RequestAuthenticationEmail() is performed successfully.

Parameters
securityCodeThe security code received from an authentication email
See also
RequestAuthenticationEmail, Result
void async 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");
}
}

◆ SubscribeToMod()

static async Task< Result > ModIO.ModIOUnityAsync.SubscribeToMod ( ModId  modId)
static

Adds the specified mod to the current user's subscriptions.

If mod management has been enabled via ModIOUnity.EnableModManagement() then the mod will be downloaded and installed.

Parameters
modIdModId of the mod you want to subscribe to
See also
Result, ModId, EnableModManagement(ModIO.ModManagementEventDelegate), GetCurrentModManagementOperation
ModProfile mod;
void async 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()

static async Task< Result > ModIO.ModIOUnityAsync.UnsubscribeFromMod ( ModId  modId)
static

Removes the specified mod from the current user's subscriptions.

If mod management has been enabled via ModIOUnity.EnableModManagement() then the mod will be uninstalled at the next opportunity.

Parameters
modIdModId of the mod you want to unsubscribe from
See also
Result, ModId, EnableModManagement(ModIO.ModManagementEventDelegate), GetCurrentModManagementOperation
ModProfile mod;
void async 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");
{
}

◆ UploadModfile()

static async Task< Result > ModIO.ModIOUnityAsync.UploadModfile ( ModfileDetails  modfile)
static

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
modfilethe mod file and details to upload
See also
Result, ModfileDetails, ArchiveModProfile, GetCurrentUploadHandle
ModId modId;
void async 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");
}
}

The documentation for this class was generated from the following file: