Skip to main content
This entities quickstart demonstrates how to work with entity objects and entity files. For information on migrating from the legacy account and data systems to PlayFab entities, see Entities migration information.

Requirements

  • A PlayFab developer account.
  • An installed copy of the Unity Editor. For information on installing the Unity Editor, see Installing Unity in the Unity documentation. You can also install a version of the Unity using the Visual Studio feature installer.
The PlayFab Unity3D SDK supports Unity Editor version 5.3 and higher.
If you are unfamiliar with Unity, recent installation packages give you the option of installing game creation walkthroughs. You can use one of the walkthroughs to create a sample game to use in the following quickstart.
  • The PlayFab Unity3D SDK.
The C# Samples in this article are written for the Unity SDK. The Unity SDK uses an event driven model to handle non-synchronous tasks. To run the sample code using the C# SDK, you must modify the code to use an async Task model. Methods that must be modified have Async append to the method name in the signature. For example, SetObject in the Unity SDK becomes SetObjectAsync in the C# SDK. For more information, see Asynchronous programming with async and await.

Terminology

Entities are any PlayFab concept that can contain data. The built-in entity types are:
  • title - A title contains global information available to all players. This is similar to TitleData. It’s identified by the title ID (TitleId) of the game/application.
  • master_player_account - This entity Type allows you to share information about a player across multiple games within a namespace. It’s identified by the player ID (PlayFabId) of the player, which is returned as part of any login or any call to retrieve account information for the player account (for example, the PlayFab Client API GetAccountInfo).
  • title_player_account - Identifies a player account that contains some information for the current title. This is identified by the entity ID (EntityKey.Id) you get back in the EntityKey object on any login.
  • character - Identifies a character that the player owns which contains information that you can retrieve. It’s identified by the character ID (CharacterId) of the character.
For more information on the built-in entity types, see Available built-in Entity types.

Entity initialization

To call any of the Entity API, you must obtain the entity ID and entity Type. You use the ID and Type to make calls to other Entity API methods. These are members of an EntityKey object. You do this by calling any of the login methods, such as LoginWithCustomID.
You can also obtain the entity ID and entity Type by calling the GetEntityToken method.
When called from the client, this typically represents the logged-in player. When called from game servers, this represents your title.

Entity objects

Entity objects allow you to read and write small JSON-serializable objects attached to an entity. All entity types support the GetObjects and SetObjects methods. The following code snippets show how to set and read an Object on a title_player_account entity. Use the SetObjects method to set entity objects on a player or a title.
Use the GetObjects method to retrieve entity objects on a player or a title.

Entity files

Entity files allow you to read and write files attached to an entity, in any format. Use the GetFiles method to retrieve entity files.
Use the initiatefileuploads method to initiate a file upload to an entity’s profile.
Use the AbortFileUploads method to abort a pending file upload to an entity’s profile.
Use the FinalizeFileUploads method to finalize file uploads to an entity’s profile. The entity system doesn’t consider the file upload complete, nor reflect any changes to other callers until the atomic upload operation is successfully finalized.
The example shown below demonstrates a full entity-file loop, from logging in, to loading a file, and uploading a new file. The steps for this are:
  • login and retrieve the entity ID and entity Type.
  • Initialize the atomic upload operation.
  • Upload all of the files.
  • Finalize the atomic upload operation.
For simplicity, this example saves one file at a time, but files can be uploaded atomically in sets. The example assumes that you’re familiar with using the Unity 3D engine.
Each file action requires many steps and multiple API calls, so don’t try to access the same file in multiple ways at the same time. If you are very careful, you might not need a locking mechanism. If you want to do something complicated, your locking mechanism may be much more complex.

Game Manager and entities

The Game Manager allows you to manipulate objects and files for players. The player overview shows both the title player and master player account information. In addition, files and objects now have their own sections in the Players tab.

See also

Introducing Entities, Objects and Files on the PlayFab blog.
Last modified on August 10, 2026