Skip to content

Commit 5e13b44

Browse files
authored
fix: Distributed authority quickstart (#1458)
1 parent 3fdc418 commit 5e13b44

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

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

+16-13
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ Before you begin, you need the following:
2929

3030
## Netcode for GameObjects setup
3131

32-
1. Using the SampleScene, add a new *Empty* object and name it *NetworkManager*.
32+
1. Using the SampleScene, add a new **Empty** object and name it **NetworkManager**.
3333

3434
2. Attach a Network Manager component to it.
3535
![add network manager](/img/learn/distributed-authority-quick-start/network-manager.png)
3636

3737
3. Under the Network Settings, set the **Network Topology** property to **Distributed Authority**.
3838
![set network topology](/img/learn/distributed-authority-quick-start/network-topology.png)
3939

40-
4. Under **Network Transport**, select **UnityTransport** from the list of options to add.
41-
![use unity transport](/img/learn/distributed-authority-quick-start/unity-transport.png)
40+
4. Under **Network Transport**, select **DistributedAuthorityTransport** from the list of options to add.
41+
![use unity transport](/img/learn/distributed-authority-quick-start/transport.png)
4242

4343
5. Save any changes to your objects and scene.
4444

4545
## Connection setup
4646

47-
1. Create a new script called *ConnectionManager.cs*. This script provides a user interface and the script logic required to connect to a distributed authority service session:
47+
1. Create a new script called **ConnectionManager.cs**. This script provides a user interface and the script logic required to connect to a distributed authority service session:
48+
4849
```cs
4950
using System;
5051
using System.Threading.Tasks;
@@ -159,12 +160,13 @@ It's important to wait until `OnClientConnectedCallback` has been triggered befo
159160

160161
:::
161162

162-
2. Add the `ConnectionManager` component script you created to the *NetworkManager* object.
163+
1. Add the **ConnectionManager** component script you created to the **NetworkManager** object.
163164
![add connection manager](/img/learn/distributed-authority-quick-start/create-connection-manager.png)
164165

165166
## Adding gameplay
166167

167-
1. Create a new Script called *PlayerCubeController.cs*:
168+
1. Create a new Script called **PlayerCubeController.cs**:
169+
168170
```cs
169171
using Unity.Netcode.Components;
170172
using UnityEngine;
@@ -247,18 +249,19 @@ public class PlayerCubeController : NetworkTransform
247249
}
248250
}
249251
```
250-
2. In the open *SampleScene*, create a 3D cube and name it *PlayerCube*.
252+
253+
2. In the open **SampleScene**, create a 3D cube and name it **PlayerCube**.
251254
![create PlayerCube object](/img/learn/distributed-authority-quick-start/player-cube.png)
252-
3. Add a NetworkObject component to the *PlayerCube*.
255+
3. Add a NetworkObject component to the **PlayerCube**.
253256
![add a NetworkObject component](/img/learn/distributed-authority-quick-start/add-networkobject.png)
254-
4. Set the NetworkObject Ownership to "None".
255-
5. Add the *PlayerCubeController* to the *PlayerCube*.
257+
4. Set the NetworkObject Ownership to **None**.
258+
5. Add the **PlayerCubeController** to the **PlayerCube**.
256259
![add the PlayerCubeController component](/img/learn/distributed-authority-quick-start/add-playercubecontroller.png)
257260
6. Create a Prefabs folder in the root Assets folder.
258-
7. Drag and drop the *PlayerCube* object into the newly created Prefabs folder.
261+
7. Drag and drop the **PlayerCube** object into the newly created Prefabs folder.
259262
![create the player cube prefab](/img/learn/distributed-authority-quick-start/create-playercube-prefab.png)
260-
8. Delete the *PlayerCube* object from your scene.
261-
9. Open the Network Manager, navigate to **Prefab Settings**, and set the **Default Player Prefab** to be the newly created *PlayerCube*.
263+
8. Delete the **PlayerCube** object from your scene.
264+
9. Open the Network Manager, navigate to **Prefab Settings**, and set the **Default Player Prefab** to be the newly created **PlayerCube**.
262265
![set the default player prefab](/img/learn/distributed-authority-quick-start/assign-default-player-prefab.png)
263266
10. Save all changes to the scene.
264267

docs/learn/distributed-authority-webgl.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,26 @@ Before you begin, you need the following general requirements to use the distrib
1818
- An active Unity account with a valid license.
1919
- The [Unity Hub](https://unity.com/download).
2020
- A supported version of the Unity 6 Editor. Refer to the [Netcode for GameObjects requirements](https://docs-multiplayer.unity3d.com/netcode/current/installation).
21-
- When installing the Editor, make sure to include the __WebGL Build Support_ module.
21+
- When installing the Editor, make sure to include the **WebGL Build Support** module.
2222

2323
You also need the following packages and minimum versions for a WebGL distributed authority session:
2424

2525
- Netcode for GameObjects version 2.1.1+
2626
- Unity Transport version 2.3.0+
27-
- Note that you don't need to create a self-signed certificate to connect to a distributed authority session.
27+
- Note that you don't need to create a self-signed certificate to connect to a distributed authority session.
2828
- Multiplayer Services version 1.0.2+
2929

3030
## Create and set up your project
3131

3232
Follow the instructions on the [distributed authority general quickstart](distributed-authority-quick-start.md) page.
3333

34+
## Configure the transport to use websockets
35+
36+
Enable the **Use Web Sockets** checkbox on the **DistributedAuthorityTransport** component that was added to the **NetworkManager** object. ![enable web sockets](/img/learn/distributed-authority-quick-start/use-websockets.png)
37+
3438
## Build and run with WebGL
3539

36-
1. Navigate to __File__ > __Build Profiles__ to open the __Build Profiles__ window. Select WebGL as your target platform.
37-
1. From the __Build Profiles__ window, click __Build and Run__.
40+
1. Navigate to **File** > **Build Profiles** to open the **Build Profiles** window. Select WebGL as your target platform.
41+
1. From the **Build Profiles** window, click **Build and Run**.
3842
- Unity launches a small web hosting app to provide the HTTP services required to launch the WebGL application in your browser.
3943
1. Once you have one instance of your WebGL project running, you can copy the URI from your browser and paste it into another window or tab, which creates and connects another player to the same session.
Loading
Binary file not shown.
Loading

0 commit comments

Comments
 (0)