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

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.

1 Like

I had this same issue, but I found a fix which only requires one upload. You just get the ID of the content when you download it, and assign the content’s ID to the downloaded content.
This doesn’t work though if you, for some reason, need the ID stored with the data, at all times, although I don’t really see what the point of doing this would be.