Describe the bug
KeyValue tags are documented (and function in steamworks) as 1:n tags:
https://partner.steamgames.com/doc/api/ISteamUGC#AddItemKeyValueTag
Multiple tags, and even duplicates of the same tag, are allowed.
In Facepunch, 1:n is allowed when writing tags. However, when reading tags off an Item, they are stored in a Dictionary of <string, string>. Duplicate values for a key collide and disappear. The current definition in UgcItem.cs is:
public Dictionary<string,string> KeyValueTags { get; internal set; }
The proper structure is:
public Dictionary<string,List> KeyValueTags { get; internal set; }
To Reproduce
-
Create multiple values for the same key using KeyValue Tags. For instance:
var result = await Steamworks.Ugc.Editor.NewCommunityFile
.WithTitle($"Test")
.AddKeyValueTag("testkey", "testvalue1")
.AddKeyValueTag("testkey", "testvalue2")
-
Read the values back with a UGCItem and notice that only one of the two values is read.
Calling Code
private static async Task<Item> GetFirstItemForQuery(Query query)
{
List<Item> itemsForQuery = await GetItemsForQuery(query);
if (itemsForQuery.Count > 0)
{
return itemsForQuery[0];
}
return new Item(0);
}
private static async Task<List<Item>> GetItemsForQuery(Query query)
{
List<Item> itemList = new();
ResultPage? page;
int x = 1;
do
{
page = await query.GetPageAsync(x);
x++;
if (page.HasValue)
{
Debug.Log($"Got page back... {page.Value.TotalCount} item");
foreach (var entry in page.Value.Entries)
{
Debug.Log($"Found item with Title:{entry.Title} and ID:{entry.Id}");
itemList.Add(entry);
}
}
} while (page.HasValue && page.Value.ResultCount > 0);
if (itemList.Count == 0)
{
Debug.Log($"Did not find any results for query.");
}
return itemList;
}
query = Query.All
.WithKeyValueTags(true);
Item item = await GetFirstItemForQuery(query);
Debug.Log(item.KeyValueTags["testkey"]);
Expected behavior
I expect to see both keys in the output
Desktop (please complete the following information):
- OS: Windows
- Unity: 2022.3.f51
Additional context
Patch incoming.
Describe the bug
KeyValue tags are documented (and function in steamworks) as 1:n tags:
https://partner.steamgames.com/doc/api/ISteamUGC#AddItemKeyValueTag
Multiple tags, and even duplicates of the same tag, are allowed.
In Facepunch, 1:n is allowed when writing tags. However, when reading tags off an Item, they are stored in a Dictionary of <string, string>. Duplicate values for a key collide and disappear. The current definition in UgcItem.cs is:
public Dictionary<string,string> KeyValueTags { get; internal set; }
The proper structure is:
public Dictionary<string,List> KeyValueTags { get; internal set; }
To Reproduce
Create multiple values for the same key using KeyValue Tags. For instance:
var result = await Steamworks.Ugc.Editor.NewCommunityFile
.WithTitle($"Test")
.AddKeyValueTag("testkey", "testvalue1")
.AddKeyValueTag("testkey", "testvalue2")
Read the values back with a UGCItem and notice that only one of the two values is read.
Calling Code
Expected behavior
I expect to see both keys in the output
Desktop (please complete the following information):
Additional context
Patch incoming.