Skip to content

Commit 62dd7b9

Browse files
committed
Apply Amy updates
1 parent 36f6a8e commit 62dd7b9

File tree

6 files changed

+49
-47
lines changed

6 files changed

+49
-47
lines changed

com.unity.netcode.gameobjects/Documentation~/advanced-topics/networkobject-parenting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Overview
44

5-
If you aren't completely familiar with transform parenting in Unity, then it's highly recommended to [review over the existing Unity documentation](https://docs.unity3d.com/Manual/class-Transform.html) before reading further. To properly synchronize all connected clients with any change in a GameObject component's transform parented status, Netcode for GameObjects requires that the parent and child GameObject components have NetworkObject components attached to them. Otherwise, you can use the [AttachableBehaviour](../components/helper/attachablebehaviour.md) and [AttachableNode](../components/helper/attachablenode.md) helper components to synchronize other types of parenting.
5+
If you aren't familiar with transform parenting in Unity, then it's recommended that you [review the existing Unity documentation](https://docs.unity3d.com/Manual/class-Transform.html) before reading further. To properly synchronize all connected clients with any change in a GameObject component's transform parented status, Netcode for GameObjects requires that the parent and child GameObject components have NetworkObject components attached to them. Otherwise, you can use the [AttachableBehaviour](../components/helper/attachablebehaviour.md) and [AttachableNode](../components/helper/attachablenode.md) helper components to synchronize other types of parenting.
66

77
## Parenting rules
88

99
- Setting the parent of a child's `Transform` directly (that is, `transform.parent = childTransform;`) always uses the default `WorldPositionStays` value of `true`.
1010
- It's recommended to always use the `NetworkObject.TrySetParent` method when parenting if you plan on changing the `WorldPositionStays` default value.
1111
- Likewise, it's also recommended to use the `NetworkObject.TryRemoveParent` method to remove a parent from a child.
12-
- When an [authority](../terms-concepts/authority.md) parents a spawned NetworkObject component under another spawned NetworkObject component during a Netcode game session this parent child relationship replicates across the network to all connected and future late joining clients.
12+
- When an [authority](../terms-concepts/authority.md) parents a spawned NetworkObject component under another spawned NetworkObject component during a Netcode game session, this parent-child relationship replicates across the network to all connected and future late-joining clients.
1313
- If, while editing a scene, you place an in-scene placed NetworkObject component under a GameObject component that doesn't have a NetworkObject component attached to it, Netcode for GameObjects preserves that parenting relationship.
1414
- During runtime, this parent-child hierarchy remains true unless the user code removes the GameObject parent from the child NetworkObject component.
1515
- **Note**: Once removed, Netcode for GameObjects won't allow you to re-parent the NetworkObject component back under the same or another GameObject component that with no NetworkObject component attached to it.
@@ -49,7 +49,7 @@ The [owner](../terms-concepts/ownership.md) of a NetworkObject can always parent
4949

5050
By default, only the [authority](../terms-concepts/authority.md) of a NetworkObject can parent a NetworkObject under a non-networked object. This means in a client-server game, only the server (or host) can control NetworkObject component parenting. In a distributed authority game the [owner](../terms-concepts/ownership.md) of the object can always parent the object.
5151

52-
To allow the owner to parent their owned object in a client-server game, use the [`NetworkObject.AllowOwnerToParent`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_AllowOwnerToParent) property.
52+
To allow the [owner](../terms-concepts/ownership.md) to parent their owned NetworkObject in a client-server game, use the [`NetworkObject.AllowOwnerToParent`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_AllowOwnerToParent) property.
5353

5454
![image](../images/networkobject/allowOwnerToParent.png)
5555

com.unity.netcode.gameobjects/Documentation~/basics/object-spawning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ When using a [server authoritative networking model](../terms-concepts/authority
3030

3131
To spawn a network prefab, you must first create an instance of the network prefab and then invoke the spawn method on the NetworkObject component of the instance you created. In most cases, you will want to keep the NetworkObject component attached to the root GameObject of the network prefab.
3232

33-
See [NetworkObject ownership](../components/core/networkobject-ownership.md) for more information.
33+
Refer to [NetworkObject ownership](../advanced-topics/networkobject-ownership.md) for more information.
3434

3535
The following is a basic example of how to spawn a network prefab instance:
3636

com.unity.netcode.gameobjects/Documentation~/components/core/networkbehaviour-ownership.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ The owner of each NetworkBehaviour in your game is decided by the owner of that
99
> [!NOTE]
1010
> The following properties are only valid if the NetworkBehaviour has been spawned. Use [`NetworkBehaviour.IsSpawned`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsSpawned) to check the spawned status of the NetworkBehaviour
1111
12-
To see if the local client is the owner of a NetworkBehaviour, you can check the[`NetworkBehaviour.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsOwner) property.
12+
To identify whether the local client is the owner of a NetworkBehaviour, you can check the[`NetworkBehaviour.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsOwner) property.
1313

14-
To see if the server owns a NetworkBehaviour, you can check the [`NetworkBehaviour.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsOwnedByServer) property.
14+
To identify whether the server owns a NetworkBehaviour, you can check the [`NetworkBehaviour.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_IsOwnedByServer) property.
1515

16-
To see if the local client has authority of a NetworkBehaviour, you can check the[`NetworkBehaviour.HasAuthority`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_HasAuthority) property.
16+
To identify whether the local client has authority of a NetworkBehaviour, you can check the[`NetworkBehaviour.HasAuthority`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.html#Unity_Netcode_NetworkBehaviour_HasAuthority) property.
1717

1818
## Detecting ownership changes
1919

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

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# NetworkObject ownership
22

3+
Manage NetworkObject ownership across different network topologies.
4+
35
Before reading these docs, ensure you understand the concepts of [ownership](../../terms-concepts/ownership.md) and [authority](../../terms-concepts/authority.md) within Netcode for GameObjects. It's also recommended to be familiar with the [NetworkObject](./networkobject.md) and [NetworkBehaviour](./networkbehaviour.md). Ownership behaves slightly differently based on your game's chosen [network topology](../../terms-concepts/network-topologies.md).
46

57
Read more about how to detect when ownership has changed in [NetworkBehaviour ownership](./networkbehaviour-ownership.md).
@@ -9,9 +11,9 @@ Read more about how to detect when ownership has changed in [NetworkBehaviour ow
911
> [!NOTE]
1012
> All NetworkObject properties are only valid while the NetworkObject is spawned. Use [`NetworkObject.IsSpawned`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsSpawned) to check the spawned status of the NetworkObject.
1113
12-
To test if the local client is the owner of a NetworkObject, you can check the[`NetworkObject.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsOwner) property. The [`HasAuthority`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_HasAuthority) property can also be used to test whether the current client has authority over the current object.
14+
To identify whether the local client is the owner of a NetworkObject, you can check the[`NetworkObject.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.IsOwner.html) or the [`NetworkBehaviour.IsOwner`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.IsOwner.html) property.
1315

14-
To test if the server owns a NetworkObject, you can check the [`NetworkObject.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_IsOwnedByServer) property.
16+
To identify whether the server owns a NetworkObject, you can check the [`NetworkObject.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.IsOwnedByServer.html) or the [`NetworkBehaviour.IsOwnedByServer`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkBehaviour.IsOwnedByServer.html) property.
1517

1618
> [!NOTE]
1719
> To assure a spawned NetworkObject persists after the owner leaves a session, set the `NetworkObject.DontDestroyWithOwner` property to true. This assures the client-owned NetworkObject doesn't get destroyed when the owning client leaves.
@@ -20,26 +22,26 @@ To test if the server owns a NetworkObject, you can check the [`NetworkObject.Is
2022

2123
When building a [client-server game](../../terms-concepts/client-server.md), only the server has the authority to spawn objects. In a [distributed authority game](../../terms-concepts/distributed-authority.md), any connected client can spawn objects.
2224

23-
The default `NetworkObject.Spawn` method sets the owner of the newly spawned object to the game client who called the spawn method.
25+
The default `NetworkObject.Spawn` method sets server-side ownership in a client-server topology. When using a distributed authority topology, this method sets the client who calls the method as the owner.
2426

2527
```csharp
2628
var NetworkObject = GetComponent<NetworkObject>.Spawn();
2729
```
2830

2931
## Spawn with ownership
3032

31-
To spawn a NetworkObject that is owned by a different game client than the one doing the spawning, use the following:
33+
To spawn a NetworkObject that's [owned](../../terms-concepts/ownership.md) by a different game client than the one doing the spawning, use the following:
3234

3335
```csharp
3436
NetworkObject.SpawnWithOwnership(clientId);
3537
```
3638

3739
> [!NOTE]
38-
> Using `SpawnWithOwnership` can result in unexpected behaviour when the spawning game client makes any other changes on the object immediately after spawning.
40+
> Using `SpawnWithOwnership` can result in unexpected behavior when the spawning game client makes any other changes on the object immediately after spawning.
3941
40-
Using `SpawnWithOwnership` and then editing the object locally will mean the client doing the spawning will behave as a "spawn authority". The spawn authority will have limited local [authority](../../terms-concepts/authority.md) over the object, but will not have [ownership](../../terms-concepts/ownership.md) of the object that is spawned. This means any owner-specific checks during the spawn sequence will not be invoked on the spawn authority side.
42+
Using `SpawnWithOwnership` and then editing the NetworkObject locally means that the client doing the spawning will behave as the spawn authority. The spawn authority has limited local [authority](../terms-concepts/authority.md) over the NetworkObject, but not [ownership](../terms-concepts/ownership.md) of the NetworkObject that's spawned. This means any owner-specific checks during the spawn sequence will not be invoked on the spawn authority side.
4143

42-
Any time you would like to spawn an object for another client and then immediately make adjustments on that object, it's recommended to use `Spawn`. After adjusting, the spawn authority can immediately follow with a call to `ChangeOwnership`.
44+
If you want to spawn a NetworkObject for another client and then immediately make adjustments to that NetworkObject, it's recommended to use the `Spawn` method. After adjusting, the spawn authority can immediately follow with a call to `ChangeOwnership`.
4345

4446
```csharp
4547
public class BreakableSpawner : NetworkBehaviour
@@ -75,7 +77,7 @@ public class Breakable : NetworkBehaviour
7577
}
7678
```
7779

78-
This flow allows the spawning client to completely spawn and finish initializing the object locally before transferring the ownership to another game client.
80+
This flow allows the spawning client to completely spawn and finish initializing the NetworkObject locally before transferring the ownership to another game client.
7981

8082
## Authority ownership
8183

@@ -99,17 +101,17 @@ NetworkObject.RemoveOwnership();
99101

100102
## Distributed authority ownership
101103

102-
When building a distributed authority game, it is important to remember that owner of an object is always the authority for that object. As the simulation is shared between clients, it is important that ownership can be easily passed between game clients. This enables:
104+
In a distributed authority topology, the owner of a NetworkObject is always the authority for that NetworkObject. Because the simulation is shared between clients, it's important that ownership can be easily passed between game clients. This enables:
103105

104-
1. Evenly sharing the load of the game simulation via redistributing objects whenever a player joins or leaves.
105-
2. Allowing ownership to be transferred immediately to a client in situations where a client is interacting with that object and so wants to remove lag from those interactions.
106-
3. Controlling when and object is safe and/or valid to be transferred.
106+
- Evenly sharing the load of the game simulation by redistributing NetworkObjects whenever a player joins or leaves.
107+
- Allowing ownership to be transferred immediately to a client in situations where the client is interacting with that NetworkObject to remove lag from those interactions.
108+
- Controlling when a NetworkObject is safe or valid to be transferred.
107109

108-
The authority of any object changes ownership as outlined in [authority ownership](#authority-ownership).
110+
The authority of any NetworkObject can always change ownership, as outlined in [authority ownership](#authority-ownership).
109111

110-
### Ownership permissions settings
112+
### Ownership permission settings
111113

112-
The following ownership permission settings, defined by [`NetworkObject.OwnershipStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipStatus.html), control how ownership of objects can be changed during a distributed authority session:
114+
The following ownership permission settings, defined by [`NetworkObject.OwnershipStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipStatus.html), control how ownership of NetworkObjects can be changed during a distributed authority session:
113115

114116
|**Ownership setting**|Description|Related Property|Multi-select|
115117
|-----|-----|-----|-----|
@@ -198,7 +200,7 @@ When a NetworkObject is set with `OwnershipPermissions.RequestRequired` any clie
198200
var requestStatus = NetworkObject.RequestOwnership();
199201
```
200202

201-
The `RequestOwnership` method will return an [`OwnershipRequestStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipRequestStatus.html) to indicate the initial status of the request. To view the result of the request, [`OnOwnershipRequestResponse`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_OnOwnershipRequestResponse) callback will be invoked with a [`NetworkObject.OwnershipRequestResponseStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus.html).
203+
`RequestOwnership` returns an [`OwnershipRequestStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipRequestStatus.html) to indicate the initial status of the request. To view the result of the request, the `OnOwnershipRequestResponse` callback will be invoked with a [`NetworkObject.OwnershipRequestResponseStatus`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus.html).
202204

203205
By default, any requests for ownership will automatically be approved. To control which client is approved for ownership, use the [`OnOwnershipRequested`](https://docs.unity3d.com/Packages/com.unity.netcode.gameobjects@latest?subfolder=/api/Unity.Netcode.NetworkObject.html#Unity_Netcode_NetworkObject_OnOwnershipRequested) callback
204206

@@ -262,7 +264,8 @@ public class RequestableOwnershipBehaviour : NetworkBehaviour
262264

263265
## Additional resources
264266

265-
* [Ownership](../../terms-concepts/ownership.md)
266-
* [NetworkObject](./networkobject.md)
267-
* [NetworkBehaviour](./networkbehaviour.md)
268-
* [NetworkBehaviour ownership](./networkbehaviour-ownership.md)
267+
- [NetworkObject](../components/core/networkobject.md)
268+
- [NetworkBehaviour](./networkbehaviour.md)
269+
- [NetworkBehaviour ownership](./networkbehaviour-ownership.md)
270+
- [Ownership](../terms-concepts/ownership.md)
271+
- [Authority](../terms-concepts/authority.md)

0 commit comments

Comments
 (0)