Skip to content

Commit ade8ce5

Browse files
refactor: NetworkTransform.SetState shouldGhostsInterpolate parameter [MTT-4462] (Unity-Technologies#2228)
* refactor MTT-4462 Renaming shouldGhostsInterpolate to teleportDisabled for better clarity of what that parameter does. While renaming it to isTeleporting would make more sense, that could potentially become a breaking change, and so the next best parameter name would be "teleportDisabled" which would not break users that use this parameter currently.
1 parent 101bf34 commit ade8ce5

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1313
### Changed
1414

1515
- The default listen address of `UnityTransport` is now 0.0.0.0. (#2307)
16+
- Renamed the NetworkTransform.SetState parameter `shouldGhostsInterpolate` to `teleportDisabled` for better clarity of what that parameter does. (#2228)
1617

1718
### Fixed
1819
- Fixed server side issue where, depending upon component ordering, some NetworkBehaviour components might not have their OnNetworkDespawn method invoked if the client side disconnected. (#2323)

com.unity.netcode.gameobjects/Components/NetworkTransform.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,9 @@ private void Initialize()
10921092
/// <param name="posIn"></param> new position to move to. Can be null
10931093
/// <param name="rotIn"></param> new rotation to rotate to. Can be null
10941094
/// <param name="scaleIn">new scale to scale to. Can be null</param>
1095-
/// <param name="shouldGhostsInterpolate">Should other clients interpolate this change or not. True by default</param>
1096-
/// new scale to scale to. Can be null
1095+
/// <param name="teleportDisabled">When true (the default) the <see cref="NetworkObject"/> will not be teleported and, if enabled, will interpolate. When false the <see cref="NetworkObject"/> will teleport/apply the parameters provided immediately.</param>
10971096
/// <exception cref="Exception"></exception>
1098-
public void SetState(Vector3? posIn = null, Quaternion? rotIn = null, Vector3? scaleIn = null, bool shouldGhostsInterpolate = true)
1097+
public void SetState(Vector3? posIn = null, Quaternion? rotIn = null, Vector3? scaleIn = null, bool teleportDisabled = true)
10991098
{
11001099
if (!IsSpawned)
11011100
{
@@ -1119,16 +1118,16 @@ public void SetState(Vector3? posIn = null, Quaternion? rotIn = null, Vector3? s
11191118
{
11201119
m_ClientIds[0] = OwnerClientId;
11211120
m_ClientRpcParams.Send.TargetClientIds = m_ClientIds;
1122-
SetStateClientRpc(pos, rot, scale, !shouldGhostsInterpolate, m_ClientRpcParams);
1121+
SetStateClientRpc(pos, rot, scale, !teleportDisabled, m_ClientRpcParams);
11231122
}
11241123
else // Preserving the ability for server authoritative mode to accept state changes from owner
11251124
{
1126-
SetStateServerRpc(pos, rot, scale, !shouldGhostsInterpolate);
1125+
SetStateServerRpc(pos, rot, scale, !teleportDisabled);
11271126
}
11281127
return;
11291128
}
11301129

1131-
SetStateInternal(pos, rot, scale, !shouldGhostsInterpolate);
1130+
SetStateInternal(pos, rot, scale, !teleportDisabled);
11321131
}
11331132

11341133
/// <summary>

0 commit comments

Comments
 (0)