I'm trying to set the DisplayProperties when creating a draft item in Unity, but i keep getting a "Invalid input parameters" error.
I've tried a plain JSON string and an object using JsonUtility.ToJson
Does anyone know what's the correct format to be placed in the DisplayProperties parameter?
Could you please provide the sample code for our reference?
var draftRequest = new CreateDraftItemRequest { Item = new CatalogItem { Type = "ugc", ContentType = contentType, AlternateIds = new List<CatalogAlternateId>() {new CatalogAlternateId(){Type = "FriendlyId", Value = levelId}}, Title = new Dictionary<string, string> { {"NEUTRAL", displayName} }, Contents = new List<Content> { fileContent }, DisplayProperties = JsonUtility.ToJson(new LevelProperties { plays = 0, wins = 0 }), DisplayVersion = "1" }, Publish = true }; PlayFabEconomyAPI.CreateDraftItem(draftRequest, OnDraftComplete, OnRequestError);
That's what a sample draft that i'm trying to setup. LevelProperties is a serializable struct with the fields just to generate the json string.
Thanks for your detailed sample code. We will test the code using Unity and PlayFab Unity SDK.
Answer by Jay Zuo · Dec 10, 2021 at 09:20 AM
From PlayFab REST API, we can see DisplayProperties is an arbitrary JSON blob. While in REST API, it's a JSON blob, then in Unity, it should be an object as the SDK will automatically serialize the object to JSON. Thus, you can change your code to:
DisplayProperties = new LevelProperties { plays = 0, wins = 0 },
What should be used to integrate Chat System in Playfab Groups/Clans? 3 Answers
How to download content from cdn? 1 Answer
Having trouble with Get content from CDN to Update my game's version in Unreal Engine 4 0 Answers
Can we create or host events in Playfab's Clan/Guild? 2 Answers
How to edit Entity Access Policy? 2 Answers