Page cover

UserGeneratedContent.Client

Like what your seeing?

Introduction

using UGCClient= HeathenEngineering.SteamworksIntegration.API.UserGeneratedContent.Client;
public static class UserGeneratedContent.Client

Events

EventItemDownloaded

Occurs when a UGC item is downloaded

public static WorkshopDownloadedItemResultEvent EventItemDownloaded;

The event handler would look similar to

void HandleEvent(DownloadItemResult_t arg0)
{
    //Do Work
}

EventWorkshopItemInstalled

Called when a workshop item has been installed or updated

The event handler would look similar to

Methods

AddAppDependency

The callback for this method would look like the following.

This is a native callback, details as to the meaning of fields in the AddAppDependencyResult_t object can be found here.

Adds a dependency between the given item and the appid. This list of dependencies can be retrieved by calling GetAppDependencies. This is a soft-dependency that is displayed on the web. It is up to the application to determine whether the item can actually be used or not.

AddDependency

This is a native callback, details as to the meaning of fields in the AddUGCDependencyResult_t object can be found here.

Adds a workshop item as a dependency to the specified item. If the nParentPublishedFileID item is of type k_EWorkshopFileTypeCollection, than the nChildPublishedFileID is simply added to that collection. Otherwise, the dependency is a soft one that is displayed on the web and can be retrieved via the ISteamUGC API using a combination of the m_unNumChildren member variable of the SteamUGCDetails_t struct and GetQueryUGCChildren.

AddExcludedTag

Adds a excluded tag to a pending UGC Query. This will only return UGC without the specified tag.

AddItemKeyValueTag

Adds a key-value tag pair to an item. Keys can map to multiple different values (1-to-many relationship). Key names are restricted to alpha-numeric characters and the '_' character. Both keys and values cannot exceed 255 characters in length. Key-value tags are searchable by exact match only.

AddItemPreviewFile

Adds an additional preview file for the item. Then the format of the image should be one that both the web and the application(if necessary) can render, and must be under 1MB.Suggested formats include JPG, PNG and GIF.

AddItemPreviewVideo

Adds an additional video preview from YouTube for the item.

AddItemToFavorites

Adds workshop item to the users favorite list. The callback to this method would look like the following

This is a native Steam API callback you can find more details here.

AddRequiredKeyValueTag

Adds a required key-value tag to a pending UGC Query. This will only return workshop items that have a key = pKey and a value = pValue.

AddRequiredTag

Adds a required tag to a pending UGC Query. This will only return UGC with the specified tag.

CreateItem

The first overload handles the creation and update of new items in a single line call.

The first parameter defines the core fields of the item to be created, note the WorkshopItemData.Create method simply calls this overload.

The remaining parameters deal with additional preview images and videos as well as the key value tag system

The callback for this overload would look similar to following.

See the WorkshopItemDataCreateStatus definition for more information on what fields it contains.

The second overload is only creates an empty UGC File. You would then manually start the update process and set each of its fields. This approach is more akin to using the Raw Steam API.

Learn more about manual creation and update of items here.

The callback for this overload would look similar to the following.

This works exsactly the same as the native Steam API callback as documented here and uses those native Steam API structures.

CreateQueryAllRequest

The UGC Query Manager can make working with quires much simpler.

Query for all matching UGC. You can use this to list all of the available UGC for your app. You must release the handle returned by this function by calling WorkshopReleaseQueryRequest when you are done with it!

CreateQueryDetailsRequest

All of the overloads do the same thing they simply reduce the need for in line conversion when using different types of collecitons.

The UGC Query Manager can make working with quires much simpler.

Query for the details of specific workshop items. You must release the handle returned by this function by calling WorkshopReleaseQueryRequest when you are done with it!

CreateQueryUserRequest

Query UGC associated with a user. You can use this to list the UGC the user is subscribed to amongst other things. You must release the handle returned by this function by calling WorkshopReleaseQueryRequest when you are done with it!

ReleaseQueryRequest

Frees a UGC query

DeleteItem

Requests delete of a UGC item

This is a native callback you can find more details on it here.

DownloadItem

Request download of a UGC item

GetAppDependencies

Request the app dependencies of a UGC item

GetItemDownloadInfo

Request the download informaiton of a UGC item

GetItemInstallInfo

Request the installation informaiton of a UGC item

GetItemInstallInfo

Request the installation informaiton of a UGC item

GetItemState

Gets the current state of a workshop item on this client.

ItemStateHasFlag

Checks if the 'checkFlag' value is in the 'value'

ItemStateHasAllFlags

Cheks if any of the 'checkflags' values are in the 'value'

GetItemUpdateProgress

Gets the progress of an item update.

GetNumSubscribedItems

Returns the number of subscribed UGC items

GetQueryAdditionalPreview

Request an additional preview for a UGC item

GetQueryChildren

Request the child items of a given UGC item

GetQueryKeyValueTag

Retrieve the details of a key-value tag associated with an individual workshop item after receiving a querying UGC call result.

GetQueryMetadata

Request the metadata of a UGC item

GetQueryNumAdditionalPreviews

Request the number of previews of a UGC item

GetQueryNumKValueTags

Request the number of key value tags for a UGC item

GetQuyPreviewURL

Get the preview URL of a UGC item

GetQueryResults

Fetch the results of a UGC query

GetQueryStatistic

Fetch the statistics of a UGC query

GetSubscribedItems

Get the file IDs of all subscribed UGC items up to the array size. This is a wrapper around the raw API entry and maintained for backward compatibility.

or

Returns the list of items the user is subscribed to as a simple array.

or

This will query for the details of the items the user is subscribed to and invoke a callback when those details are returned.

GetUserItemVote

Get the item vote value of a UGC item. The callback for this would look like the following

GetWorkshopEULAStatus

Asynchronously retrieves data about whether the user accepted the Workshop EULA for the current app. The callback for this method would look like the following.

ShowWorkshopEULA

Show the app's latest Workshop EULA to the user in an overlay window, where they can accept it or not

RemoveAppDependency

Request the removal of app dependency from a UGC item

RemoveDependency

Request the removal of a dependency from a UGC item

RemoveItemFromFavorites

Request the item be removed from the user's favourites list if present

RemoveItemKeyValueTags

Remove UGC Item key value tags

RemoveItemPreview

Remove UGC Item Preview

RequestDetails

Request details of a given UGC item

SendQueryUGCRequest

Send a UGC query for processing

SetAllowCashedResponse

Set the allow cashed response on Steam

SetCloudFileNameFilter

Set the file name filter value for use with queries

SetItemContent

Sets the folder path that Valve will upload from when submitting an item update

SetItemDescription

Sets the item description of the item when submitting an item update

SetItemMetadata

Sets the item metadata of the item when submitting an item update

SetItemPreview

SetItemTags

SetItemTitle

SetItemUpdateLanguage

SetItemVisibility

SetLanguage

SetMatchAnyTag

SetRankedByTrendDays

SetReturnAdditionalPreviews

SetReturnChildren

SetReturnKeyalueTags

SetReturnLongDescription

SetReturnMetadata

SetReturnOnlyIDs

SetReturnPlaytimeStats

Set a query to return the playtime stats for related items

SetReturnTotalOnly

Set a query to only return the total number of files that match the arguments

SetSearchText

Sets the search text used when executing a UGC query

SetUserItemVote

Sets the vote value for a given item from this user.

StartItemUpdate

Request the start of an item update. This must be called before you set item preview, description, etc.

StartPlaytimeTracking

Start tracking playtime for the indicated items.

StopPlaytimeTracking

Stop tracking playtime for the indicated items.

StopPlaytimeTrackingForAllItems

Stop tracking playtime for all relevant items

SubmitItemUpdate

Submit an update request committing any changes made since the StartItemUpdate request.

SubscribeItem

Subscribe to the indicated item

SuspendDownloads

Suspend downloads

UnsubscribeItem

Unsubscribe to the indicated item

UpdateItemPreviewFile

Update item preview image file

UpdateItemPreviewVideo

Update item preview video

How To

Create and Update Items

Creating a new item can be done in one of two ways.

One liner

When using the 1 liner approach you will first create a Workshop Item Data object. This object defines the item you wish to create e.g. its name, description, content folder, etc.

The callback for this method is a delegate that takes 1 parameter of type Workshop Item Data Create Status.

Example:

Assuming a method such as

Then you can call the method such as

To learn more about callbacks please read the related article.

The status returned to the callback will indicate the status of the operation. Note that the operation occurs in two stages. First a blank item is created and then once that has been found successful that blank item will be updated with the content and settings indicated thus it is possible for a blank item to be created but for the update to fail. Please see the results in the status object for more details.

Step by step

This callback will contain a UGCUpdateHandle_t which can be used by other methods to update key features using the following methods

You can also use these tools to modify and existing file assuming you are its author

  • AddItemKeyValueTag

  • AddItemPreviewFile

  • AddItemPreviewVideo

  • SetItemContent

  • SetItemDescription

  • SetItemMetadata

  • SetItemPreview

  • SetItemTags

  • SetItemTitle

  • SetItemUpdateLanguage

  • SetItemVisibility

  • UpdateItemPreviewVideo

  • UpdateItemPreviewFIle

  • UpdateItemPreviewVideo

  • RemoveItemKeyValueTags

  • RemoveItemPreview

For example the following code would update the title and description

When complete you should submit the update

Browse Items

The easiest way to handle a UGC / Workshop browser in game is to use the UGC Query Manager. The manager uses the same features present in the interface so it can be done manually.

The remainder of this section talks about manually querying items.

The process is similar in that you would "create" or "start" a query which will give you a UGCQueryHandle_t which can then be modified to fine tune your query before submitting it to get the matching records.

To crete the UGCQueryHandle_t

Once you have created your handle you can modify the way it searches for matching items by calling the following methods.

  • AddExcludeTag

  • AddRequiredKeyValueTag

  • AddRequiredTag

  • SetAllowCashedResponse

  • SetCloudFileNameFilter

  • SetLanguage

  • SetMatchAnyTag

  • SetRankedByTrendDays

  • SetReturnAdditionalPreviews

  • SetReturnChildren

  • SetReturnKeyValueTags

  • SetReturnLongDescription

  • SetReturnMetadata

  • SetReturnOnlyIDs

  • SetReturnPlaytimeStats

  • SetReturnTotalOnly

  • SetSearchText

Once you have your query set up you can submit it to fetch the related items. Note the UGC Query system is a page query system. It will never return more than 50 items (determined by Valve) and so you will need to increment the page in your query handle to fetch each successive set of records.

You can see how we implemented paging in the UGC Query Manager if you wished to do so your self or simply to better understand the system.

When the callback is invoked its parameter will indicate the result state and query handle, assuming the state is eResultOk you can fetch the found items via, the following assumes param is the SteamUGCQueryComplete_t object returned by the SendQueryUGCRequest's callback

Getting the next page of data is done the same way, you will need to track what page your on and howmany there are and create a new query updating the page.

Our UGC Query Manager does this fore you. You can simply incrament the page by calling SetPage and we will release any existing handle and fetch a new handle for the next page. You will need to re apply any modifications to the query you may have done before executing it again.

Get Subscribed Items

To get the list of subscirbed items e.g. items the user has indicated should be installed

Last updated