Skip to main content

Searching for UGC

When setting up UGC in your game, you'll want ways for users to search for and install (aka subscribe to) UGC. This guide will run you through the basics on how to do so.

This guide covers:

Browsing UGC

After initializing the plugin and authenticating a user, you can query the available mods using ListAllModsAsync.

ListAllModsAsync supports filtering by name, tag, author, mature content, and more using ModioFilterParams. You can sort results as specified by ModioSortFieldType, and request paginated or indexed results. By default, ModioFilterParams asks for the first 100 results (the maximum number returnable in a query) sorted by ModioModID.

void UModioManagerSubsystem::ListAllMods()
{
if (UModioSubsystem* Subsystem = GEngine->GetEngineSubsystem<UModioSubsystem>())
{
FModioFilterParams Filter;
// Build the filter by chaining together multiple calls
Filter.PagedResults(1, 5).IndexedResults(3, 5).WithTags("Multiplayer").SortBy(EModioSortFieldType::ID, EModioSortDirection::Descending);

Subsystem->ListAllModsAsync(Filter, FOnListAllModsDelegateFast::CreateUObject(this, &UModioManagerSubsystem::OnListAllModsComplete));
}
}

void UModioManagerSubsystem::OnListAllModsComplete(FModioErrorCode ErrorCode, TOptional<FModioModInfoList> OptionalModList)
{
// Ensure ListAllModsAsync was successful
if (!ErrorCode)
{
// ModList is guaranteed to be valid if there is no error
TArray<FModioModInfo> ModInfoArray = OptionalModList.GetValue().GetRawList();

// Do something with ModInfoArray

// You can use OptionalModList().GetValue().Paged related methods to make further paginated requests if required
}
}

Next steps

Now your users can add and search for UGC, it's time to set up the ability to subscribe to and download UGC by implementing the Subscribing to UGC guide.

If you've already done this, we recommend working your way through the Unreal Getting Started Guides as they will teach you how to implement the fundamentals of the Unreal Engine Plugin before moving onto exploring our Features