LootLocker
The BasicsGame SystemsContent ManagementPlayer Management
LootLocker
  • 📌The Basics
    • Getting Started
    • What is LootLocker?
    • Core Concepts
      • Players
      • Assets
      • Character Classes
      • API Types
      • Web Console
      • Stage & Live Environments
      • Glossary
    • Unity Quick Start
      • Install the SDK
      • Configure the SDK
      • Authenticate Your First Player
      • Update the SDK
    • Unreal Quick Start
      • Install & Configure the SDK
        • Older versions
      • Authenticate Your First Player
    • Godot Quick Start
      • Install the SDK
      • Configure the SDK
      • Authenticate Your First Player
      • Update the SDK
    • SDKs
    • Samples
      • Authentication Samples
      • Leaderboard Samples
      • Progression Samples
      • Player Samples
    • Launching Your Game
    • Support
      • Error Codes
      • Unreal Marketplace Plugin Support
  • 🎭Players
    • Overview
    • Authentication
      • How To
        • Guest Login
        • Steam
        • Apple
        • Apple Game Center
        • Google
        • Epic Games
        • PlayStation
        • Meta / Oculus
        • Xbox
        • Nintendo Switch
    • Files
      • How To
        • Manage Files in Web Console
        • Work with Files In-Game
    • Inventory
      • How To
        • Work with Player Inventory
    • Messages
      • How To
        • Configure Messages in Web Console
    • Names
      • How To
        • Work with Player Names
    • Player Manager
      • How To
        • Manage Players through Web Console
        • Manage Players In-Game
        • Use Player Operations
    • Unified Player Accounts
      • How To
        • Configure UPA in Web Console
        • Use Remote Login In-Game
        • Connect Identiy Provider to Player
        • External Provider Linking
        • Transition from Guest Login to Other Provider
        • Disconnect Identity Provider from Player
    • White Label Login
      • How To
        • Configure White Label Login
        • Create a New White Label User
        • Request User Verification
        • Handle Returning Users
        • Start a White Label Session
  • 🪙Commerce
    • Overview
    • Catalogs
      • How To
        • Configure Catalogs in LootLocker Console
        • List all Catalogs
        • Use Catalogs In-Game
        • Setup In-Game Store
    • Currencies
      • How To
        • Configure a Currency in Web Console
        • Use Currencies In-Game
    • DLC Management
      • How To
        • Configure DLC in Web Console
        • Use DLC In-Game
    • Entitlements
      • How To
        • Work with Entitlements In-Game
    • Real Money Purchases
      • How To
        • Configure In-App Purchase in Web Console
        • Make Purchases through Google Play Store
        • Make Purchases through Apple Store
        • Make Purchases through Steam Store
    • Virtual Purchases
    • Wallets
      • How To
        • Manage a Wallet in Web Console
        • Use Wallets In-Game
  • ⚔️Content
    • Overview
    • Assets
      • How To
        • Create & Configure an Asset
        • Organize & Search for Assets
        • Retrieve Assets In-Game
        • Set up Asset Storage Template
        • Check Grant Notifications
        • Set up a Game Config Asset
        • Create a Loot Box
        • Work with Loot Boxes In-Game
        • Create a Drop Table
        • Work with Drop Tables In-Game
        • Create a Rental Asset
        • Work with Rental Assets In-Game
    • User Generated Content (UGC)
      • How To
        • Create UGC In-Game
    • Twitch Drops
  • 🕹️Game Systems
    • Overview
    • Classes & Heroes
      • How To
        • Base Classes
        • Hero Classes
        • Implement Classes In-Game
        • Implement Heroes In-Game
    • Leaderboards
      • How To
        • Configure Leaderboard in Web Console
        • Use Player Leaderboards
        • Use Generic Leaderboards
        • Use Metadata to Store Additional Information
        • Use Scheduled Reset with Rewards
        • Use Leaderboards for Time Based Rankings
      • Leaderboard FAQ
      • GameMaker References
    • Feedback
      • How To
        • Manage Feedback Categories
        • Create Player Feedback
        • Create UGC Feedback
        • Create Game Feedback
        • View and Manage Feedback
    • Progressions
      • How To
        • Create a Progression
        • Game Progressions
        • Player Progressions
        • Class Progressions
        • Asset Instance Progressions
    • Triggers
      • How To
        • Setup a trigger in the Web Console
        • Invoke trigger from game
  • ⛓️Shared Systems
    • Overview
    • Metadata
      • How To
        • Add Metadata in Console
        • Fetch a Single Metadata In-Game
        • Fetch Metadata In-Game by Tags
        • Fetch Metadata In-Game from Multiple Sources
    • Notifications
      • How To
        • List Notifications and Mark as Read In-Game
  • 🗝️Admin
    • Settings
    • User Settings
    • Organization Settings
    • CORS Allowlist
  • ⭕️ Legacy
    • Deprecations
      • Unity SDK Deprecation Log
        • Version 2.1.5 - Migration to Open UPM
        • Version 2.0.0
      • Unreal SDK Deprecation Log
        • Version 4.0.0
        • Version 3.0.0
    • Legacy Storage
    • Legacy Triggers
      • Activate a trigger
      • Create a trigger
    • Legacy Progressions
      • Create a Progression System
      • Use a Progression System In-Game
Powered by GitBook
On this page
  • Prerequisites
  • Create an asset candidate
  • Working with the asset candidate
  • Delete the asset candidate
  • Add files to the asset candidate
  • Remove files from the Asset candidate
  • Update or add data to the asset candidate
  • Conclusion
  1. Content
  2. User Generated Content (UGC)
  3. How To

Create UGC In-Game

PreviousHow ToNextTwitch Drops

Last updated 7 months ago

In this How-to, we’ll go through the process of creating a UGC asset candidate, adding some information to it and promoting it to a UGC asset that can be viewed by all players in your game.

Prerequisites

  • Optional A context to use for the newly created UGC, if none is provided

Create an asset candidate

The first thing a user needs to do is to create an asset candidate, which is the “working state” of UGC in LootLocker.

// Name is required when creating an asset candidate
string name = "New Asset Candidate";

// The below additional variables are optional
Dictionary<string, string> kv_storage = new Dictionary<string, string>();
kv_storage.Add("key", "value"); // Optional
Dictionary<string, string> filters = new Dictionary<string, string>();
filters.Add("key", "value"); // Optional
Dictionary<string, string> data_entities = new Dictionary<string, string>();
filters.Add("data", "name"); // Optional
int context_id = -1; // Optional

string asset_candidate_id = "";
LootLockerSDKManager.CreatingAnAssetCandidate(name, kv_storage, filters, data_entities, (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully created asset candidate with ID: " + response.asset_candidate_id);
        // Save the asset_candidate_id for future requests
        asset_candidate_id = response.asset_candidate_id;
    }
    else
    {
        Debug.Log("Error asset candidate");
    }
});
curl -X POST "https://api.lootlocker.io/game/v1/player/assets/candidates" \
  -H "x-session-token: your_token_here" \
  -H "Content-Type: application/json" \
  -d "{\"data\": {\"name\": \"My UGC Asset\"}}"

We need the asset_instance_id for future requests, wait for the request to be done and save the asset_candidate_id before calling the next request.

Working with the asset candidate

After the asset candidate has been created you have several ways of modifying it:

Delete the asset candidate

int assetCandidateID = 13;
LootLockerSDKManager.DeletingAnAssetCandidate(assetCandidateID, (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully deleted asset candidate");
    }
    else
    {
        Debug.Log("Error deleting asset canddidate");
    }
});
curl -X DELETE "https://api.lootlocker.io/game/v1/player/assets/candidates/1234" \
  -H "x-session-token: your_token_here"

The 1234 in the url is the asset_candidate_id that will be deleted

Add files to the asset candidate

int assetCandidateID = 12;
string filePath = "Assets/Resources/300.jpg";
string fileName = "300.jpg";
LootLocker.LootLockerEnums.FilePurpose fileType = LootLocker.LootLockerEnums.FilePurpose.primary_thumbnail;
LootLockerSDKManager.AddingFilesToAssetCandidates(assetCandidateID, filePath, fileName, fileType, (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully added image to asset candidate");
    }
    else
    {
        Debug.Log("Error adding image to asset candidate");
    }
});
curl -L -X POST 'https://api.lootlocker.io/game/v1/player/assets/candidates/1234/file' \
  -H "x-session-token: your_token_here" \
  -F 'file=@/path/to/file.ext' \
  -F 'purpose=PRIMARY_THUMBNAIL'

Remove files from the Asset candidate

int assetCandidateID = 12;
int fileID = 1;
LootLockerSDKManager.RemovingFilesFromAssetCandidates(assetCandidateID, fileID, (response) =>
{
    if (response.success)
    {
      Debug.Log("Successfully removed file from asset candidate");
    }
    else
    {
      Debug.Log("Error removing file from asset candidate");
    }
});
curl -X DELETE "https://api.lootlocker.io/game/v1/player/assets/candidates/1234/file/5678" \
  -H "x-session-token: your_token_here"

The 1234 in the url is the asset_candidate_id, 5678 is the file_id that can be retrieved when creating the file or inspecting the asset candidate

Update or add data to the asset candidate

bool isCompleted = false;
// When updating an asset, all properties are optional.
// Empty fields are also updated, only update the ones that you want to replace
string name = "New Name"; // Optional
Dictionary<string, string> kv_storage = new Dictionary<string, string>();
kv_storage.Add("key", "value"); // Optional
Dictionary<string, string> filters = new Dictionary<string, string>();
filters.Add("key", "value"); // Optional
Dictionary<string, string> data_entities = new Dictionary<string, string>();
filters.Add("data", "name"); // Optional
int context_id = -1; // Optional
LootLockerSDKManager.UpdatingAnAssetCandidate(asset_candidate_id, isCompleted, (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully updated asset candidate with ID: " + response.asset_candidate.id);
    }
    else
    {
        Debug.Log("Error updating asset candidate");
    }
}, name, kv_storage, filters, data_entities, context_id);

The boolean "IsCompleted" should be false to Update the asset candidate!

The Boolean "Is Completed", when it is set to true, the Asset Candidate will be sent for moderation, if that is enabled on your game. If Moderation is disabled, the asset will be promoted to an asset.

When Updating the Asset Candidate, it is important to remember that it is not enough to just set the values that you do want to update, you have to set every value. This is due to the fact that empty fields will update. So to update, you will need the data from the non-updated version and update from there.

curl -X PUT "https://api.lootlocker.io/game/v1/player/assets/candidates/1234" \
  -H "x-session-token: your_token_here" \
  -H "Content-Type: application/json" \
  -d "{\"completed\": true, \"data\": {\"name\": \"My Renamed Asset Candidate\"}}"

When you are satisfied with the changes to the asset candidate, you simply call the UpdatingAnAssetCandidate() function again, and change the isCompleted bool to true and the asset candidate will then be promoted to a UGC asset to be viewed by all your players.

Conclusion

See the for a list of supported properties

See the for a list of supported update properties

In this How-to, we’ve created a UGC asset candidate, added some information to it and promoted it to an asset. If UGC moderation is enabled in your game, the newly generated asset will show up in the in the web console for you to take action on, and otherwise it will be available instantly to all your players by using any of the . With UGC it can also be a good idea to add a way for players to .

⚔️
An active Game Session
a default context will be given
reference docs
reference docs
UGC moderation tab
ListAssets() functions
report the created content
Blueprint example of creating an asset candidate
Blueprint example of deleting an asset candidate
Blueprint example of adding files to an asset candidate
Blueprint example of deleting files from an asset candidate
Blueprint example of updating an asset candidate