question

tomglenn avatar image
tomglenn asked

GrantCharacterToUser Throws ItemNotOwned Error When Name Has Spaces

I've been scratching my head for over an hour wondering why my player could not create a character using:

/Client/GrantCharacterToUser { ItemId = "_characterToken", CharacterName = "Azelus Skye" }

I kept receiving ItemNotFound errors, even though I could clearly see in my PlayFab dashboard that my player did indeed have a _characterToken.

It turns out that because I entered a space in my character name, that was the reason it was failing. Changing it to Azelus worked.

I see in the docs it says CharacterName must be between 1-20 characters, but I cannot see anywhere where it says it cannot contain a space. I would really like my players to be able to enter a name with spaces. Is this even possible with PlayFab? It seems like a huge oversight if not.

Characters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Actually, the CharacterName is just a string with a min/max length - there's no regex on it other than that. Testing in my own title, I'm able to make characters with spaces in their names, no problem - I tested with both the Server and Admin API calls. The only way to get ItemNotOwned, lookin at the code, is if the player doesn't have an instance of the Item ID in question in his inventory. If you're seeing something else, can you provide the Title ID, PlayFab ID of the player account, Item ID you're using for character creation, and the specifics of the parameters you're passing into the call?

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tomglenn avatar image tomglenn commented ·

Hi @Brendan

Thanks for getting back to me so quickly.

I've retested this morning and I'm getting a different error now... InvalidItemProperties

TitleID: 2863

PlayFabID of Player: 19EE911FB45B4105
ItemID of Character Token: _characterToken

Item Instance ID of token in players inventory: 32306CBCCE9D7B27

Catalog Version: 0.1

C# Api Call:

var request = new GrantCharacterToUserRequest { CharacterName = name, ItemId = "_characterToken", CatalogVersion = "0.1" };

The error I receive from error.GenerateErrorReport() is:

/Client/GrantCharacterToUser: Unable to find item with id 3616510058954586919InvalidItemProperties
UnityEngine.Debug:Log(Object)


Thanks

0 Likes 0 ·
brendan avatar image brendan tomglenn commented ·

That error specifically means that the item instance you're trying to use to create a character is not tagged as a token for character creation. One thing to bear in mind is that if you changed the item in the catalog to be a token for character creation after you've already granted that item to players, the item instances already granted to players are not retroactively changed to be tokens for character creation. The properties of the item instance are established from the catalog at the time the instance is created.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.