Skip to content

Commit 473fcd8

Browse files
update
Further clarifying the update to NetworkObject.SpawnWithOwnership
1 parent aef1185 commit 473fcd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

com.unity.netcode.gameobjects/Documentation~/components/core/networkobject.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ To spawn NetworkObjects with ownership use the following:
4747
GetComponent<NetworkObject>().SpawnWithOwnership(clientId);
4848
```
4949
> [!NOTE]
50-
> When using the `SpawnWithOwnership` method in a client-server network topology, be aware that any component that has owner-specific checks to perform specific actions will not be invoked on the server side during the spawn sequence. This can impact things like [NetworkTransform](../helper/networktransform.md) when set to an owner authority motion model. To avoid issues, it's recommended to use `Spawn` where the server is the owner during the spawn sequence and then immediately follow with a call to `ChangeOwnership`. These two actions will get combined into a single `CreateObjectMessage` and avoid potential latency-driven issues.
50+
> When using the `SpawnWithOwnership` method, be aware that any component that has owner-specific checks to perform specific actions will not be invoked on the spawn authority side during the spawn sequence. The spawn authority is the server when using a client-server network topology and can be any client when using a distributed authority network topology. Using `SpawnWithOwnership` can impact things like [NetworkTransform](../helper/networktransform.md), when using to an owner authority motion model, and potentially provide undesired parenting artifacts and/or impact your own scripts if you are planning to have the spawn authority make any further post-spawn adjustments within the same frame.
51+
>To avoid potential issues, it's recommended to use `Spawn`, where the spawn authority starts as the owner throughout the spawn sequence, makes adjustments post-spawn, and then immediately follow with a call to `ChangeOwnership`.
5152
5253
To change ownership, use the `ChangeOwnership` method:
5354

0 commit comments

Comments
 (0)