Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Best approach to store the returned content Id inside the content itself?

Discussion in 'Unity User-Generated Content' started by SorneBachse, Aug 12, 2023.

  1. SorneBachse


    Dec 27, 2012
    I'm trying to decide on the best approach for my situation. I'm developing a level editor that allows users to upload their own levels and share them. To do this, I use the generated content ID that's returned when content is created using the UgcService.Instance.CreateContentAsync method.

    Here's the challenge:
    I want to save this content ID inside my level files, along with other info like the level ID and owner ID. Right now, I have two options. I can upload the level, get the content ID back, add it to my level file, and then upload the modified level again (so it's stored in Unity's UGC services). Or, I can upload a "placeholder" just to get the ID, and then quickly update the existing content with the actual level data (after assigning the content ID) using UgcService.Instance.CreateContentVersionAsync.

    I'm not sure which approach is better.
    Another idea is to store all the different IDs in a separate metadata file. I would upload the level first, and then upload the metadata file, which would be smaller and use less bandwidth, but it's still 2 uploads every time.

    I would appreciate any suggestions you have on how to handle this situation.