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.
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 replacestring name ="New Name"; // OptionalDictionary<string,string> kv_storage =newDictionary<string,string>();kv_storage.Add("key","value"); // OptionalDictionary<string,string> filters =newDictionary<string,string>();filters.Add("key","value"); // OptionalDictionary<string,string> data_entities =newDictionary<string,string>();filters.Add("data","name"); // Optionalint context_id =-1; // OptionalLootLockerSDKManager.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.
See the reference docs for a list of supported update properties
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
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 UGC moderation tab 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 ListAssets() functions. With UGC it can also be a good idea to add a way for players to report the created content.