Skip to content

Commit 492efa7

Browse files
committed
U-PR review comments
1 parent 2393dcc commit 492efa7

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

com.unity.netcode.gameobjects/Documentation~/upgrade-guide.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Upgrade from 2.x to 3.x
22

3-
Update your project for the Unity Editor, dependency, and API changes that Netcode for GameObjects 3.x introduces.
3+
Update your project for the Unity Editor, assembly definition, dependency, and API changes that Netcode for GameObjects 3.x introduces.
44

5-
Version 3.x of Netcode for GameObjects raises the minimum Unity Editor version and adds a dependency on Netcode for Entities. It also renames the Editor assembly definitions and turns several obsolete API warnings into compile errors. Refer to the following sections for the changes that affect your project and the steps to take for each one.
5+
Version 3.x of Netcode for GameObjects raises the minimum Unity Editor version, renames the Editor assembly definitions, and turns several obsolete API warnings into compile errors. Refer to the following sections for the changes that affect your project and the steps to take for each one.
66

77
> [!WARNING]
88
> The API updater modifies your files in place. Commit or back up your work before you update your project.
@@ -21,7 +21,7 @@ Version 3.x depends on the Netcode for Entities package (`com.unity.netcode`), w
2121
To upgrade an existing project from version 2.x to version 3.x, follow these steps:
2222

2323
1. Back up your project, or commit your work to source control.
24-
1. Upgrade your project to Unity Editor version 6000.7 or later.
24+
1. Upgrade your project to Unity Editor version 6.7 or later.
2525
1. From the Unity Editor, select **Window** > **Package Manager**.
2626
1. From the **Package Manager** window, select **Netcode for GameObjects** in the list of packages.
2727
1. Select version 3.x, then select **Update**.
@@ -44,7 +44,7 @@ Version 3.x renames the Editor assembly definitions to the `Unity.Netcode.GameOb
4444
| --- | --- |
4545
| `Unity.Netcode.Editor` | `Unity.Netcode.GameObjects.Editor` |
4646
| `Unity.Netcode.Editor.CodeGen` | `Unity.Netcode.GameObjects.Editor.CodeGen` |
47-
| `Unity.Netcode.Editor.PackageChecker` | `Unity.Netcode.GameObjects.PackageChecker.Editor` |
47+
| `Unity.Netcode.PackageChecker.Editor` | `Unity.Netcode.GameObjects.PackageChecker.Editor` |
4848
| `Unity.Netcode.Editor.Tests` | `Unity.Netcode.GameObjects.Editor.Tests` |
4949

5050
If your own Editor assemblies reference any of these assembly definitions by name, update the reference to the new name. The API updater migrates references to the moved Editor namespace types for you.
@@ -65,11 +65,29 @@ Replace each of the following APIs with its listed replacement:
6565
| `[ServerRpc(RequireOwnership = true)]` | `[Rpc(SendTo.Server, InvokePermission = RpcInvokePermission.Owner)]` |
6666
| `[ServerRpc(RequireOwnership = false)]` | `[Rpc(SendTo.Server, InvokePermission = RpcInvokePermission.Everyone)]` |
6767
| `ConnectionAddressData.ServerEndPoint` (`ParseNetworkEndpoint`) | `NetworkEndpoint.Parse` on the `Address` field |
68-
| `CommandLineOptions.Instance` | `TryGetArg` |
6968
| `NetworkBehaviourEditor.GetRootParentTransform(Transform)` | `transform.root` |
7069

7170
The `RequireOwnership` field applies to `ServerRpc` and the other remote procedure call (RPC) attributes. Use `InvokePermission` in its place. For more information, refer to [RPCs](advanced-topics/message-system/rpc.md).
7271

72+
### Replace command-line argument lookups
73+
74+
Version 3.x raises a compile error for both `CommandLineOptions.Instance` and the `CommandLineOptions.GetArg` instance method, so a typical `Instance.GetArg` call needs a full rewrite rather than a rename. Use the static `CommandLineOptions.TryGetArg` method, which reports whether it found the argument and returns the value through an `out` parameter:
75+
76+
```csharp
77+
// Version 2.x
78+
var value = CommandLineOptions.Instance.GetArg("--myArg");
79+
if (value != null)
80+
{
81+
// Use value.
82+
}
83+
84+
// Version 3.x
85+
if (CommandLineOptions.TryGetArg("--myArg", out var value))
86+
{
87+
// Use value.
88+
}
89+
```
90+
7391
### APIs without replacements
7492

7593
Remove your use of each of the following APIs:

0 commit comments

Comments
 (0)