Skip to content

Implement Heroes In-Game

This how-to creates, updates, and manages Hero Characters and their equipped Assets from your game.

Prerequisites

Create Heroes

Create a Hero Character based on a Hero Class.

int heroID = 1;
string heroName = "Mage";
LootLockerSDKManager.CreateHero(heroID, heroName, true,(response) =>
{
if (!response.success)
{
Debug.Log("Could not create Hero");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

Update Heroes

Update a Hero's name or default setting.

string heroID = "1";
string heroName = "Mage";
LootLockerSDKManager.UpdateHero(heroID, heroName, true, (response) =>
{
if (!response.success)
{
Debug.Log("Could not update Hero");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

List Player Heroes

Use this API to list all Heroes associated to a player.

LootLockerSDKManager.ListPlayerHeroes((response) =>
{
if (!response.success)
{
Debug.Log("Could not list Player Heroes");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

List Game Heroes

List all Heroes associated to the specific game.

LootLockerSDKManager.GetGameHeroes((response) =>
{
if (!response.success)
{
Debug.Log("Could not get Game Heroes");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

Get Hero Loadout

Use this API to retrieve a Loadout of a specific Player Hero.

LootLockerSDKManager.GetHeroLoadout((response) =>
{
if (!response.success)
{
Debug.Log("Could not get Hero Loadout");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

Get Other Player's Hero Loadout

Retrieve another Players' Hero's Loadout.

int heroID = 2;
LootLockerSDKManager.GetOtherPlayersHeroLoadout(heroID, (response) =>
{
if (!response.success)
{
Debug.Log("Could not get Hero Loadout");
return;
}
});

Equip Asset to Hero

Equip an Asset to a player's Hero.

int heroID = 2;
int assetInstanceID = 152;
LootLockerSDKManager.AddAssetToHeroLoadout(heroID, assetInstanceID, (response) =>
{
if (!response.success)
{
Debug.Log("Could not add Asset to Hero Loadout");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

Unequip Asset from Hero

Use this API call to unequip an Asset from a Hero.

string heroID = "2";
int assetInstanceID = 152;
LootLockerSDKManager.RemoveAssetFromHeroLoadout(assetInstanceID, heroID, (response) =>
{
if (!response.success)
{
Debug.Log("Could not unequip Asset to Hero Loadout");
return;
}
});

To see what data gets returned, please refer to our Reference Documentation.

Conclusion

You've created, updated, and managed Hero Characters and their equipped Assets from your game. Next, review LootLocker's full feature set to decide which other features to implement.