Skip to content

Commit 3c3afe1

Browse files
jabbacakesVic-CooperDSchroerr-machLagowiecDev
authored
Develop into main (#1298)
Co-authored-by: Vic Cooper <[email protected]> Co-authored-by: Dominick <[email protected]> Co-authored-by: Rémi MACH <[email protected]> Co-authored-by: LagowiecDev <[email protected]> Co-authored-by: amanda-butler-unity <[email protected]> Co-authored-by: Noel Stephens <[email protected]> Co-authored-by: Griffin of Innatical <[email protected]> Co-authored-by: Christopher Pope <[email protected]> Co-authored-by: Steve Diniro <[email protected]> Co-authored-by: s-omeilia-unity <[email protected]> Co-authored-by: Alex Martin <[email protected]> Co-authored-by: Monaxys <[email protected]> Co-authored-by: Flap27 <[email protected]> Co-authored-by: NRTnarathip <[email protected]> Co-authored-by: Elfi0Kuhndorf <[email protected]> Co-authored-by: CodeSmile <[email protected]> Co-authored-by: Frank Luong <[email protected]> Co-authored-by: Sue Arkin <[email protected]>
1 parent 23b7ab8 commit 3c3afe1

File tree

91 files changed

+516
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+516
-509
lines changed

docs/learn/distributed-authority-quick-start.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Before you begin, you need the following:
5050
```cs
5151
using System;
5252
using System.Threading.Tasks;
53+
using Unity.Netcode;
5354
using Unity.Services.Authentication;
5455
using Unity.Services.Core;
5556
using Unity.Services.Multiplayer;
@@ -136,8 +137,9 @@ public class ConnectionManager : MonoBehaviour
136137
AuthenticationService.Instance.SwitchProfile(_profileName);
137138
await AuthenticationService.Instance.SignInAnonymouslyAsync();
138139

139-
var options = new CreateSessionOptions(_maxPlayers) {
140-
Name = _sessionName
140+
var options = new SessionOptions() {
141+
Name = _sessionName,
142+
MaxPlayers = _maxPlayers
141143
}.WithDistributedConnection();
142144

143145
_session = await MultiplayerService.Instance.CreateOrJoinSessionAsync(_sessionName, options);
@@ -278,15 +280,16 @@ public class PlayerCubeController : NetworkTransform
278280
![create PlayerCube object](/img/learn/distributed-authority-quick-start/player-cube.png)
279281
3. Add a `NetworkObject` component to the *PlayerCube*.
280282
![add a NetworkObject component](/img/learn/distributed-authority-quick-start/add-networkobject.png)
281-
4. Add the *PlayerCubeController* to the *PlayerCube*.
283+
4. Set the `NetworkObject` Ownership to "None".
284+
5. Add the *PlayerCubeController* to the *PlayerCube*.
282285
![add the PlayerCubeController component](/img/learn/distributed-authority-quick-start/add-playercubecontroller.png)
283-
5. Create a Prefabs folder in the root Assets folder.
284-
6. Drag and drop the *PlayerCube* object into the newly created Prefabs folder.
286+
6. Create a Prefabs folder in the root Assets folder.
287+
7. Drag and drop the *PlayerCube* object into the newly created Prefabs folder.
285288
![create the player cube prefab](/img/learn/distributed-authority-quick-start/create-playercube-prefab.png)
286-
6. Delete the *PlayerCube* object from your scene.
287-
5. Open the Network Manager, navigate to **Prefab Settings**, and set the **Default Player Prefab** to be the newly created *PlayerCube*.
289+
8. Delete the *PlayerCube* object from your scene.
290+
9. Open the Network Manager, navigate to **Prefab Settings**, and set the **Default Player Prefab** to be the newly created *PlayerCube*.
288291
![set the default player prefab](/img/learn/distributed-authority-quick-start/assign-default-player-prefab.png)
289-
6. Save all changes to the scene.
292+
10. Save all changes to the scene.
290293

291294
## Next steps
292295

mppm/about.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ title: About Multiplayer Play Mode
44
description: Overview of Multiplayer Play Mode
55
---
66

7-
Use Multiplayer Play Mode to test multiplayer functionality within the Unity Editor. You can simulate up to four players (the Main Editor and three Virtual Players) simultaneously on the same development device while using the same source assets on disk. Multiplayer Play Mode can help you create multiplayer development workflows that reduce project build times, run it locally, and test the server-client relationship.
7+
Use Multiplayer Play Mode to test multiplayer functionality within the Unity Editor. You can simulate up to four Players (the main Editor Player and three Virtual Players) simultaneously on the same development device while using the same source assets on disk. Multiplayer Play Mode can help you create multiplayer development workflows that reduce project build times, run it locally, and test the server-client relationship.
8+
9+
## Compatibility
10+
11+
Multiplayer Play Mode version 1.1.0 is compatible with Unity Editor versions 6000.0.3f1 or later.
812

913
## Compatibility
1014

@@ -14,24 +18,24 @@ Multiplayer Play Mode version 1.1.0 is compatible with Unity Editor versions 600
1418

1519
The following have specific meaning in relation to Multiplayer Play Mode:
1620

17-
* Main Editor: The original instance of the project in the Unity Editor. This is the only instance with full authoring capabilities.
18-
* Virtual Players: Simulated players created with Multiplayer Play Mode. These players open in a separate window with limited authoring capabilities when you enter [Play mode](https://docs.unity3d.com/Manual/GameView.html).
19-
* Players: All player instances, including the Main Editor Player and all Virtual Players.
21+
* main Editor Player: The original instance of the project in the Unity Editor. This is the only instance with full authoring capabilities.
22+
* Virtual Players: Simulated Players created with Multiplayer Play Mode. These Players open in a separate window with limited authoring capabilities when you enter [Play mode](https://docs.unity3d.com/Manual/GameView.html).
23+
* Players: All Player instances, including the main Editor Player and all Virtual Players.
2024

2125
## Limitations
2226

2327
Multiplayer Play Mode has some inherent technical limitations, specifically around [scale](#scale) and [authoring](#authoring).
2428

2529
### Scale
2630

27-
The Unity Editor and Virtual Players require a lot of system resources, so you shouldn't use Multiplayer Play Mode at scale. Multiplayer Play Mode is designed for small-scale, local testing environments that can only support up to four total players (the Main Editor and three Virtual Players).
31+
The Unity Editor and Virtual Players require a lot of system resources, so you shouldn't use Multiplayer Play Mode at scale. Multiplayer Play Mode is designed for small-scale, local testing environments that can only support up to four total Players (the main Editor Player and three Virtual Players).
2832

2933
### Authoring
30-
You can't create or change the properties of GameObjects in a Virtual Player. Instead, use the Main Editor to make changes and a Virtual Player to test multiplayer functionality. Any changes you make in Play Mode in the Main Editor reset when you exit Play Mode.
34+
You can't create or change the properties of GameObjects in a Virtual Player. Instead, use the main Editor Player to make changes and a Virtual Player to test multiplayer functionality. Any changes you make in Play Mode in the main Editor Player reset when you exit Play Mode.
3135
:::note
32-
You can't access any Main Editor functionality from Virtual Players.
36+
You can't access any main Editor Player functionality from Virtual Players.
3337
:::
3438

3539
## Performance impact
3640

37-
To reduce the demand on system resources caused by each Virtual Player instance, Multiplayer Play Mode shares specific resources, such as the artifact database and imports between the Main Editor and each Virtual Player.
41+
To reduce the demand on system resources caused by each Virtual Player instance, Multiplayer Play Mode shares specific resources, such as the artifact database and imports between the main Editor Player and each Virtual Player.
+11-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
id: multiplayer-role
3-
title: Assign virtual players to a multiplayer role
4-
description: Learn how to use the dedicated server package to assign virtual players to a multiplayer role.
3+
title: Assign Virtual Players to a multiplayer role
4+
description: Learn how to use the dedicated server package to assign Virtual Players to a multiplayer role.
55
---
66

7-
Install the [Dedicated Server package](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) with Multiplayer Play Mode to switch players between the server and client role without a script.
7+
Install the [Dedicated Server package](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) with Multiplayer Play Mode to switch Players between the server and client role without a script.
88

99
::: Important
1010
To avoid errors, install the Dedicated Server package version that is the same as the Multiplayer Play mode version that exists in your project.
1111
:::
1212

13-
## Set the main editor player multiplayer role
13+
## Set the main Editor Player multiplayer role
1414

15-
To set the role of a the main editor player, do the following:
15+
To set the role of a the main Editor Player, do the following:
1616

1717
1. Open the Multiplayer Play Mode inspector (**Multiplayer** > **Multiplayer Play Mode**).
18-
2. In the **Main Editor Player** section, expand the **Multiplayer Role** dropdown.
19-
3. Select the [multiplayer role](https://docs.unity3d.com/Packages/[email protected]/manual/multiplayer-roles.html) you want the main editor to use.
18+
2. In the **main Editor Player** section, expand the **Multiplayer Role** dropdown.
19+
3. Select the [multiplayer role](https://docs.unity3d.com/Packages/[email protected]/manual/multiplayer-roles.html) you want the main Editor Player to use.
2020

21-
## Set the multiplayer role of a virtual player
21+
## Set the multiplayer role of a Virtual Player
2222

23-
To set the role of a [virtual player](../../virtual-players), do the following:
23+
To set the role of a [Virtual Player](../../virtual-players), do the following:
2424

2525
1. Open the Multiplayer Play Mode inspector (**Multiplayer** > **Multiplayer Play Mode**).
26-
2. In the **Virtual Players** section, expand a virtual player's **Multiplayer Role** dropdown.
27-
3. Select the [multiplayer role](https://docs.unity3d.com/Packages/[email protected]/manual/multiplayer-roles.html) you want this player to use.
26+
2. In the **Virtual Players** section, expand a Virtual Player's **Multiplayer Role** dropdown.
27+
3. Select the [multiplayer role](https://docs.unity3d.com/Packages/[email protected]/manual/multiplayer-roles.html) you want this Player to use.

mppm/install.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ To install the Multiplayer Play Mode package, follow these steps:
1616

1717
## Next steps
1818

19-
You can now access and configure your [Virtual Players](../virtual-players) and their [Player Tags](../player-tags).
19+
You can now access and configure your [Virtual Players](../virtual-players) and their [tags](../player-tags).
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
id: player-tags-attach
3-
title: Attach Player Tags to a player
4-
description: Learn how to attach Player Tags to a player in Multiplayer Play Mode.
3+
title: Attach tags to a Player
4+
description: Learn how to attach tags to a Player in Multiplayer Play Mode.
55
---
66

7-
To assign one or more [Player Tags](../../player-tags) to any player, do the following:
7+
To assign one or more [tags](../../player-tags) to any Player, do the following:
88

99
1. Open the Multiplayer Play mode window (**Window** > **Multiplayer Play Mode**).
10-
2. Expand the **Tags** dropdown for a Player or the Main Editor.
10+
2. Expand the **Tags** dropdown for a Player or the main Editor Player.
1111
3. Select **+ Create Tag**.
1212
4. In the Project Settings window that appears, select the **Add** (**+**) icon.
13-
5. In the New Player Tag field that appears, type a name for your tag.
13+
5. In the New tag field that appears, type a name for your tag.
1414
6. Select **Save**.
1515
7. In the Multiplayer Play Mode window, expand the **Tags** dropdown.
1616
8. Select the tag you just created.

mppm/player-tags/player-tags-configure.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
id: player-tags-configure
3-
title: Configure Player Tags
4-
description: Set up Player Tags to use them to configure the player actions.
3+
title: Configure tags
4+
description: Set up tags to use them to configure the player actions.
55
---
66

7-
Player Tags don't do anything until you configure them. To configure a player tag, do the following:
7+
Tags don't do anything until you configure them. To configure a tag, do the following:
88

9-
1. Use `CurrentPlayer.ReadOnlyTags()` to target the Player Tag in a script.
9+
1. Use `CurrentPlayer.ReadOnlyTags()` to target the tag in a script.
1010
2. Attach the script to a [NetworkObject](https://docs-multiplayer.unity3d.com/netcode/current/basics/networkobject/), for example, the **Player**.
1111

12-
Use the following **Player Tag** examples as guides for your own scripts:
12+
Use the following tag examples as guides for your own scripts:
1313

1414
- [For a **Player** to run as a server, client, or host](../target-instance)
1515
- [To automatically assign a **Player** to a team](../target-team)
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
id: player-tags-create
3-
title: Create a Player Tags
4-
description: Use these steps to create Player Tags to configure the player actions in Multiplayer Play Mode.
3+
title: Create a tag
4+
description: Use these steps to create tags to configure the player actions in Multiplayer Play Mode.
55
---
66

7-
To create a **Player Tag**, perform the following actions:
7+
To create a tag, perform the following actions:
88

99
1. To open the Multiplayer Play mode window, navigate to **Window** > **Multiplayer Play Mode**.
10-
2. Expand the Tags dropdown for a Player or the Main Editor.
10+
2. Expand the Tags dropdown for a Player or the main Editor Player.
1111
3. Select ![plus sign](/img/add.png) Create Tag.
12-
4. Name the **Player Tag**.
12+
4. Name the tag.
1313
5. Select **Save**. The new tag is automatically added to the local project directory in `...Projects\[example-project-name]\ProjectSettings\VirtualProjectsConfig.json`.
1414
6. 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**.

mppm/player-tags/player-tags.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
id: player-tags
3-
title: Player Tags
4-
description: Learn how to use Player Tags to configure player actions in Multiplayer Play Mode.
3+
title: Information about tags
4+
description: Learn how to use tags to configure Player actions in Multiplayer Play Mode.
55
---
66

7-
Player 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:
7+
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:
88

99
- Run as a client, server, or host automatically
1010
- Automatically run as a member of a specific team (for example, “Red Team” or “Blue Team”)
1111
- Move faster or slower to simulate their network connection
1212

13-
You can assign multiple tags to a player.
13+
You can assign multiple tags to a Player.
1414

1515
<!--
1616
<div className="table-columns-plain" >
@@ -20,6 +20,6 @@ You can assign multiple tags to a player.
2020

2121
|**Page** |**Description**|
2222
|-|-|
23-
|[Create Player Tag](../player-tags/player-tags-create)| Learn how to create player tags in code.|
24-
|[Configure Player tag](../player-tags/player-tags-configure)| Learn how to set up player tags to work in your project|
25-
|[Attach a Player Tag to a player](../player-tags/player-tags-attach)| Learn how to assign tags to a specific player.|
23+
|[Create tag](../player-tags/player-tags-create)| Learn how to create tags in code.|
24+
|[Configure tag](../player-tags/player-tags-configure)| Learn how to set up tags to work in your project|
25+
|[Attach a tag to a Player](../player-tags/player-tags-attach)| Learn how to assign tags to a specific Player.|

mppm/player-tags/target-instance.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
id: target-instance
3-
title: Use Player Tags to run a player as a server, client, or host
3+
title: Use tags to run a player as a server, client, or host
44
description: This example shows how you can use Netcode for GameObjects to run a Player as a server, client, or host in Multiplayer Play Mode.
55
---
66

7-
This example explains how to target **Player Tags** in your game scripts with `CurrentPlayer.ReadOnlyTags()`. You can place these scripts where you want, but you must attach the scripts to a [NetworkObject](https://docs-multiplayer.unity3d.com/netcode/current/basics/networkobject/) (such as the **Player**).
7+
This example explains how to target tags in your game scripts with `CurrentPlayer.ReadOnlyTags()`. You can place these scripts where you want, but you must attach the scripts to a [NetworkObject](https://docs-multiplayer.unity3d.com/netcode/current/basics/networkobject/) (such as the **Player**).
88

9-
You can also use the dedicated server package to set a player tag to server, client, or host. For more information, refer to [Use Multiplayer Play Mode with a Dedicated Server](../dedicated-server/play-mode-dedicated-server.md).
9+
You can also use the dedicated server package to set a tag to server, client, or host. For more information, refer to [Use Multiplayer Play Mode with a Dedicated Server](../dedicated-server/play-mode-dedicated-server.md).
1010

11-
## Set a player tag to server, client, or host in a script
11+
## Set a tag to server, client, or host in a script
1212

13-
The following script uses the Netcode for GameObjects [NetworkManager](https://docs-multiplayer.unity3d.com/netcode/current/components/networkmanager/) to automatically connect the Virtual Player as a server, client, or host based on their Player Tag. A Player with the `Server` Player Tag automatically runs as a server, and a Player with the `Client` Player Tag automatically runs as a client.
13+
The following script uses the Netcode for GameObjects [NetworkManager](https://docs-multiplayer.unity3d.com/netcode/current/components/networkmanager/) to automatically connect the Virtual Player as a server, client, or host based on their tag. A Player with the `Server` tag automatically runs as a server, and a Player with the `Client` tag automatically runs as a client.
1414

1515
:::important
1616
This example uses the `Contains` method, which is case-sensitive by default. To make it case-insensitive, pass the `System.StringComparison.CurrentCultureIgnoreCase` method.

mppm/player-tags/target-network.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ title: Configure a Player to simulate different network connections example
44
description: This example shows how you can use the Network Simulator and Players to test different network connections in Multiplayer Play Mode.
55
---
66

7-
The logic in the following example checks if the **Player Tag** has a string rather than if it’s equal to a string to allow for more flexibility with the name of the **Player Tag**. You can change this logic so that it checks for an exact match.
7+
The logic in the following example checks if the tag has a string rather than if it’s equal to a string to allow for more flexibility with the name of the tag. You can change this logic so that it checks for an exact match.
88

99
## Simulate network conditions
1010

11-
This example script uses the Network Simulation Presets from the [Multiplayer Tools package](https://docs-multiplayer.unity3d.com/tools/current/install-tools/) to automatically simulate a fast or slow network based on the Player Tag. A Player with the `FastNetwork` Player Tag simulates a common [Home Broadband](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/#home-broadband-connections) connection, and a Player with the `SlowNetwork` Player Tag simulates a [Mobile 2.5G](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/#mobile-25g) connection.
11+
This example script uses the Network Simulation Presets from the [Multiplayer Tools package](https://docs-multiplayer.unity3d.com/tools/current/install-tools/) to automatically simulate a fast or slow network based on the tag. A Player with the `FastNetwork` tag simulates a common [Home Broadband](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/#home-broadband-connections) connection, and a Player with the `SlowNetwork` tag simulates a [Mobile 2.5G](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/#mobile-25g) connection.
1212

1313
:::note
1414
This example uses the [Network Simulator](https://docs-multiplayer.unity3d.com/tools/current/tools-network-simulator/) tool from the `com.unity.multiplayer.tools` package.

0 commit comments

Comments
 (0)