Player tags
Tags are similar to launch arguments for Players (both the main Editor Player and Virtual Players) that you can use to configure Players to behave in a specific way. For example:
- Automatically run as a member of a specific team (for example, “Red Team” or “Blue Team”)
- Move faster or slower to simulate their network connection
You can assign multiple tags to a Player.
To create a tag
To create a tag, perform the following actions:
- To open the Multiplayer Play mode window, navigate to Window > Multiplayer Play Mode.
- Expand the Tags dropdown for a Player or the main Editor Player.
- Select
Create Tag.
- Name the tag.
- Select Save. The new tag is automatically added to the local project directory in
...\[example-project-name]\ProjectSettings\VirtualProjectsConfig.json
. - The new tag also appears under the Player Tags section of the Multiplayer Play Mode window and in the dropdown menu for the Tag option of each Player.
To Attach tags to a Player
To assign one or more tags to any Player, do the following:
- Open the Multiplayer Play mode window (Window > Multiplayer Play Mode).
- Expand the Tags dropdown for a Player or the main Editor Player.
- Select + Create Tag.
- In the Project Settings window that appears, select the Add (+) icon.
- In the New tag field that appears, type a name for your tag.
- Select Save.
- In the Multiplayer Play Mode window, expand the Tags dropdown.
- Select the tag you just created.
To use tags in a player script
Tags don't do anything until you configure them. To configure a tag, do the following:
- Use
CurrentPlayer.ReadOnlyTags()
to target the tag in a script. - Attach the script to a NetworkObject, for example, the Player.
Use the following tag examples as guides for your own scripts: