Published Jun 28, 2024
FetchAllUploadedContent (Unity)
- Declaration
public static void FetchAllUploadedContent(Action<List<CavrnusRemoteContent>> onCurrentContentArrived)
- Description
Gives you a list of all the available content on your Cavrnus domain. Returns a list of type CavrnusRemoteContent. This is useful when displaying a menu of uploaded file options to your users.
- Sample
using CavrnusSdk.API;
using System.IO;
using UnityEngine;
public class PlantsFilePicker : MonoBehaviour
{
public PlantPickerUi pickerUi;
// Start is called before the first frame update
void Start()
{
//Don't bother fetching content list until we are authenticated
CavrnusFunctionLibrary.AwaitAuthentication(auth => RefreshLibraryContent());
}
public void RefreshLibraryContent()
{
CavrnusFunctionLibrary.FetchAllUploadedContent(allContent =>
{
//Remove all the old options, in case one got deleted
pickerUi.Clear();
foreach (var item in allContent)
{
//We only want fbx files
if (!Path.GetExtension(item.FileName).ToLowerInvariant().Equals(".fbx"))
continue;
//We only want files tagged as plants. We added this tag when we called UploadContent
if (!item.Tags.ContainsKey("FileType") || item.Tags["FileType"] != "Plant")
continue;
pickerUi.ShowContentOption(item);
}
});
}
}
Looking for labels? They can now be found in the details panel on the floating action bar.
Related content
FetchAllUploadedContent (Unreal Engine)
FetchAllUploadedContent (Unreal Engine)
More like this
FetchFileById (Unity)
FetchFileById (Unity)
More like this
UploadContent (Unity)
UploadContent (Unity)
More like this
UploadContent (Unreal Engine)
UploadContent (Unreal Engine)
More like this
UploadContentWithTags (Unreal Engine)
UploadContentWithTags (Unreal Engine)
More like this
CavrnusRemoteContent (Unity)
CavrnusRemoteContent (Unity)
More like this