I'm new to Playfab, and trying to upload a test UGC item from within my game in Unity C#
Following this article:
https://docs.microsoft.com/en-us/gaming/playfab/features/commerce/ugc/publish-ugc
I've managed to successfully call CreateUploadUrls and have it return a sensible success response. I then take the settings in the response to create a CreateDraftItem call, and it fails with this error:
"One of the provided content or image URLs cannot be found in XForge storage. You must use content URLs created by XForge only. Correlation Id: KN3LEMxO2UWlAeGr+O8mSA.0"
I can make it give other sensible errors (if I say forget to pass the IDs through or specify a non-existent category), but I think I'm doing everything right here, and can't find any information online on this error.
On the Game Manager dashboard we have UGC enabled, players have permission to CreateUploadURLs and CreatDraftItems, and "Character" is set up as a UGC category.
Here's the code:
public static void UploadCharacter(Character ch) { CreateUploadUrlsRequest uploadRequest = new CreateUploadUrlsRequest(); uploadRequest.Files = new List<UploadInfo>(); UploadInfo portraitInfo = new UploadInfo(); portraitInfo.FileName = ch.characterNameAndID + ".png"; uploadRequest.Files.Add(portraitInfo); UploadInfo charInfo = new UploadInfo(); charInfo.FileName = ch.characterNameAndID + ".xml"; uploadRequest.Files.Add(charInfo); uploadRequest.AuthenticationContext = PlayFabLogin.authContext; PlayFab.PlayFabEconomyAPI.CreateUploadUrls(uploadRequest, OnUploadSuccess, OnUploadFail, customData: ch.characterNameAndID); } static void OnUploadFail(PlayFabError error) { Debug.LogError(error.ErrorMessage); } static void OnUploadSuccess(CreateUploadUrlsResponse response) { string characterNameAndID = response.CustomData as string; CreateDraftItemRequest request = new CreateDraftItemRequest(); request.Item = new PlayFab.EconomyModels.CatalogItem(); request.Item.Type = "ugc"; request.Item.Title = new Dictionary<string, string>(); request.Item.Title["neutral"] = characterNameAndID; request.Item.Description = new Dictionary<string, string>(); request.Item.Description["neutral"] = "Downloadable Test Character"; request.Item.ContentType = "Character"; request.Item.IsHidden = false; Content content = new Content(); content.Url = response.UploadUrls[1].Url; content.Id = response.UploadUrls[1].Id; request.Item.Contents = new List<Content>(); request.Item.Contents.Add(content); Image image = new Image(); image.Type = "Thumbnail"; image.Url = response.UploadUrls[0].Url; image.Id = response.UploadUrls[0].Id; request.Item.Images = new List<Image>(); request.Item.Images.Add(image); request.AuthenticationContext = PlayFabLogin.authContext; request.Publish = true; PlayFab.PlayFabEconomyAPI.CreateDraftItem(request, UploadItemSuccess, UploadItemError); } static void UploadItemSuccess(CreateDraftItemResponse response) { Debug.LogError("Item uploaded correctly!"); } static void UploadItemError(PlayFabError error) { Debug.LogError(error.ErrorMessage); }
Can anyone offer any tips or other help?