question

sevdanski avatar image
sevdanski asked

Entity System Examples

I was just wondering if there were any examples of how to use the entity system with characters?

I've been trying to read the docs but I keep getting an internal error on the relevant pages (eg: https://api.playfab.com/documentation/entity/method/GetEntityToken)

I know that you can create an entity key and query but I wasn't sure what the Id should be for a character as the docs about characters say that their Id's are not globally unique and need to be validated with a player id.

If someone could point me in the right direction, that would be great.

entitiesCharacters
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

·
Andy avatar image
Andy answered

Oh, that's weird. Where did you find that link? The proper updated link is here: https://api.playfab.com/documentation/Authentication/method/GetEntityToken. I think they just changed around some of the organization for the entity docs, so it's possible there's a dead link somewhere. There's also a little more documentation about using entities here: https://api.playfab.com/docs/tutorials/entities/getting-started-entities

Short story is that you shouldn't need to worry about id collisions for characters when using the entity api.

5 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.

Andy avatar image Andy ♦♦ carl commented ·

You're right! I was able to find quite a few more. I'll get a bug on the docs team. Thanks!

0 Likes 0 ·
Andy avatar image Andy ♦♦ Andy ♦♦ commented ·

The docs team is amazing and fixed the majority of the broken links. I think there are still a few in search results, but the tutorials should be clean now.

0 Likes 0 ·
sevdanski avatar image sevdanski commented ·

Awesome. Thanks for chasing that up so quickly.
Just to confirm, would the steps for working with a Character entity be:

  1. Get the character id
  2. Create an EntityKey for using the character id and character type
  3. Get an EntityToken via the GetEntityToken() using the entity key
  4. Use GetObjects / SetObjects to read and edit the characters data
0 Likes 0 ·
Andy avatar image Andy ♦♦ sevdanski commented ·

Yep, that works. You can remove one step by using the LoginTitlePlayerAccountEntity parameter of the player login request. If you set that to true, it will return an EntityToken that can be used for subsequent player and character entity requests.

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.