Skip to content

Commit 7d9ffd5

Browse files
committed
Fix wording
1 parent 7a49a9a commit 7d9ffd5

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ internal void SetNetworkParenting(ulong? latestParent, bool worldPositionStays)
21572157
/// </summary>
21582158
/// <param name="parent">The new parent for this NetworkObject transform will be the child of.</param>
21592159
/// <param name="worldPositionStays">If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before.</param>
2160-
/// <returns>Whether or not reparenting was successful.</returns>
2160+
/// <returns>Whether or not re-parenting was successful.</returns>
21612161
public bool TrySetParent(Transform parent, bool worldPositionStays = true)
21622162
{
21632163
// If we are removing ourself from a parent
@@ -2177,7 +2177,7 @@ public bool TrySetParent(Transform parent, bool worldPositionStays = true)
21772177
/// </summary>
21782178
/// <param name="parent">The new parent for this NetworkObject transform will be the child of.</param>
21792179
/// <param name="worldPositionStays">If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before.</param>
2180-
/// <returns>Whether or not reparenting was successful.</returns>
2180+
/// <returns>Whether or not re-parenting was successful.</returns>
21812181
public bool TrySetParent(GameObject parent, bool worldPositionStays = true)
21822182
{
21832183
// If we are removing ourself from a parent
@@ -2218,7 +2218,7 @@ public bool TryRemoveParent(bool worldPositionStays = true)
22182218
/// </summary>
22192219
/// <param name="parent">The new parent for this NetworkObject transform will be the child of.</param>
22202220
/// <param name="worldPositionStays">If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before.</param>
2221-
/// <returns>Whether or not reparenting was successful.</returns>
2221+
/// <returns>Whether or not re-parenting was successful.</returns>
22222222
public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
22232223
{
22242224
if (!AutoObjectParentSync)
@@ -2235,7 +2235,7 @@ public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
22352235
// It wouldn't make sense to not allow parenting, but keeping this note here as a reminder.
22362236
var isAuthority = HasAuthority || (AllowOwnerToParent && IsOwner);
22372237

2238-
// If we don't have authority and we are not shutting down, then don't allow any parenting.
2238+
// If we don't have authority, and we are not shutting down, then don't allow any parenting.
22392239
// If we are shutting down and don't have authority then allow it.
22402240
if (!isAuthority && !NetworkManager.ShutdownInProgress)
22412241
{
@@ -2295,7 +2295,7 @@ private void OnTransformParentChanged()
22952295
return;
22962296
}
22972297
transform.parent = m_CachedParent;
2298-
Debug.LogException(new NotListeningException($"{nameof(NetworkManager)} is not listening, start a server or host before reparenting"));
2298+
Debug.LogException(new NotListeningException($"{nameof(NetworkManager)} is not listening, start a server or host before re-parenting"));
22992299
return;
23002300
}
23012301
var isAuthority = false;
@@ -2307,18 +2307,17 @@ private void OnTransformParentChanged()
23072307
// If we do not have authority and we are spawned
23082308
if (!isAuthority && IsSpawned)
23092309
{
2310-
2311-
// If the cached parent has not already been set and we are in distributed authority mode, then log an exception and exit early as a non-authority instance
2310+
// If the cached parent has not already been set, and we are in distributed authority mode, then log an exception and exit early as a non-authority instance
23122311
// is trying to set the parent.
23132312
if (distributedAuthority)
23142313
{
23152314
transform.parent = m_CachedParent;
2316-
NetworkLog.LogError($"[Not Owner] Only the owner-authority of child {gameObject.name}'s {nameof(NetworkObject)} component can reparent it!");
2315+
NetworkLog.LogError($"[Not Owner] Only the owner-authority of child {gameObject.name}'s {nameof(NetworkObject)} component can re-parent it!");
23172316
}
23182317
else
23192318
{
23202319
transform.parent = m_CachedParent;
2321-
Debug.LogException(new NotServerException($"Only the server can reparent {nameof(NetworkObject)}s"));
2320+
Debug.LogException(new NotServerException($"Only the server can re-parent {nameof(NetworkObject)}s"));
23222321
}
23232322
return;
23242323
}
@@ -2336,7 +2335,7 @@ private void OnTransformParentChanged()
23362335
else
23372336
{
23382337
transform.parent = m_CachedParent;
2339-
Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be reparented after being spawned"));
2338+
Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be re-parented after being spawned"));
23402339
}
23412340
return;
23422341
}
@@ -2356,7 +2355,7 @@ private void OnTransformParentChanged()
23562355
{
23572356
transform.parent = m_CachedParent;
23582357
AuthorityAppliedParenting = false;
2359-
Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be reparented under another spawned {nameof(NetworkObject)}"));
2358+
Debug.LogException(new SpawnStateException($"{nameof(NetworkObject)} can only be re-parented under another spawned {nameof(NetworkObject)}"));
23602359
return;
23612360
}
23622361

@@ -2457,7 +2456,7 @@ internal bool ApplyNetworkParenting(bool removeParent = false, bool ignoreNotSpa
24572456
var parentNetworkObject = transform.parent.GetComponent<NetworkObject>();
24582457

24592458
// If parentNetworkObject is null then the parent is a GameObject without a NetworkObject component
2460-
// attached. Under this case, we preserve the hierarchy but we don't keep track of the parenting.
2459+
// attached. Under this case, we preserve the hierarchy, but we don't keep track of the parenting.
24612460
// Note: We only start tracking parenting if the user removes the child from the standard GameObject
24622461
// parent and then re-parents the child under a GameObject with a NetworkObject component attached.
24632462
if (!parentNetworkObject)
@@ -2476,7 +2475,7 @@ internal bool ApplyNetworkParenting(bool removeParent = false, bool ignoreNotSpa
24762475
else
24772476
{
24782477
// If we made it this far, go ahead and set the network parenting values
2479-
// with the WorldPoisitonSays value set to false
2478+
// with the WorldPositionSays value set to false.
24802479
// Note: Since in-scene placed NetworkObjects are parented in the scene
24812480
// the default "assumption" is that children are parenting local space
24822481
// relative.
@@ -2489,7 +2488,7 @@ internal bool ApplyNetworkParenting(bool removeParent = false, bool ignoreNotSpa
24892488
}
24902489
}
24912490

2492-
// If we are removing the parent or our latest parent is not set, then remove the parent
2491+
// If we are removing the parent or our latest parent is not set, then remove the parent.
24932492
// removeParent is only set when:
24942493
// - The server-side NetworkObject.OnTransformParentChanged is invoked and the parent is being removed
24952494
// - The client-side when handling a ParentSyncMessage
@@ -3192,7 +3191,7 @@ internal SceneObject GetMessageSceneObject(ulong targetClientId = NetworkManager
31923191
// Handle Parenting
31933192
if (!AlwaysReplicateAsRoot && obj.HasParent)
31943193
{
3195-
var parentNetworkObject = transform.parent.GetComponent<NetworkObject>();
3194+
var parentNetworkObject = m_CachedParent.GetComponent<NetworkObject>();
31963195

31973196
if (parentNetworkObject)
31983197
{

0 commit comments

Comments
 (0)