Skip to content

Commit 989d9b4

Browse files
doc
Updated some XML API documentation and corrected a typo in a comment.
1 parent 358d3cf commit 989d9b4

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

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

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ internal uint BitSet
129129
/// <summary>
130130
/// When set, non-authority instances will smoothly transition between
131131
/// world and local space.
132+
/// <see cref="NetworkTransform.SwitchTransformSpaceWhenParented"/>
132133
/// </summary>
133134
internal bool SwitchTransformSpaceWhenParented
134135
{
@@ -1498,26 +1499,23 @@ internal bool SynchronizeScale
14981499
/// </summary>
14991500
/// <remarks>
15001501
/// This is synchronized by the authority. During runtime, this should only be changed by the
1501-
/// authoritative side. Non-authoritative instances will be overridden by the next
1502-
/// authoritative state update.<br />
1502+
/// authoritative side. Non-authoritative instances will be overridden by the currently applied authoritative state update.<br />
15031503
/// Note:<br />
1504-
/// When <see cref="SwitchTransformSpaceWhenParented"/> is enabled, this field will be automatically adjusted.
1505-
/// Adjusting this field during runtime and when <see cref="SwitchTransformSpaceWhenParented"/> isn't enabled.
1504+
/// When <see cref="SwitchTransformSpaceWhenParented"/> is enabled, this field will be automatically adjusted and will no longer be visible in the inspector view.
1505+
/// It is not recommended to adjust this field during runtime when <see cref="SwitchTransformSpaceWhenParented"/> is enabled.
15061506
/// </remarks>
15071507
[Tooltip("Sets whether this transform should sync in local space or in world space")]
15081508
public bool InLocalSpace = false;
15091509

15101510
/// <summary>
1511-
/// When enabled, the NetworkTransform will automatically handle transitioning into the respective transform space when its <see cref="NetworkObject"/> parent changes.<br />
1512-
/// When parented: Automatically transitions into local space and coverts any existing pending interpolated states to local space on non-authority instances.<br />
1513-
/// When deparented: Automatically transitions into world space and converts any existing pending interpolated states to world space on non-authority instances.<br />
1514-
/// Set on the root <see cref="NetworkTransform"/> instance (nested <see cref="NetworkTransform"/> components should be pre-set in-editor to local space. <br />
1511+
/// When enabled: The NetworkTransform will automatically handle transitioning into the respective transform space when its <see cref="NetworkObject"/> parent changes.<br />
1512+
/// When parented: Automatically transitions into local space and coverts any pending interpolation states to the relative local space on non-authority instances.<br />
1513+
/// When de-parented: Automatically transitions into world space and coverts any pending interpolation states to the relative local space on non-authority instances.<br />
15151514
/// </summary>
15161515
/// <remarks>
15171516
/// Only works with <see cref="NetworkTransform"/> components that are not paired with a <see cref="NetworkRigidbody"/> or <see cref="NetworkRigidbody2D"/> component that is configured to use the rigid body for motion.<br />
15181517
/// <see cref="TickSyncChildren"/> will automatically be set when this is enabled.
1519-
/// This field doesn't auto-synchronize with non-authority clients if changed on the authority instance during runtime (so you should apply this setting in-Editor).
1520-
/// Read the NetworkTransform documentation for more information and to avoid improper use.
1518+
/// This field is auto-synchronize with non-authority clients if changed by the authority instance.
15211519
/// </remarks>
15221520
[Tooltip("When enabled, NetworkTransform controls world or local space settings while also providing smooth parenting transitions." +
15231521
"When disabled, world or local space settings have to be adjusted by script or in the inspector view.")]
@@ -1726,7 +1724,6 @@ internal NetworkTransformState LocalAuthoritativeNetworkState
17261724
/// When interpolation is disabled, this value is applied immediately to the transform.
17271725
/// When interpolation is enabled, this value is only updated in the event that if
17281726
/// interpolation is disabled the last known state position update will be continually applied.
1729-
/// This might not be the exact
17301727
/// </summary>
17311728
private Vector3 m_LastStateTargetPosition;
17321729
private Vector3 m_InternalCurrentScale;
@@ -3983,19 +3980,16 @@ internal override void InternalOnNetworkObjectParentChanged(NetworkObject parent
39833980

39843981
#region API STATE UPDATE METHODS
39853982
/// <summary>
3986-
/// Directly sets a state on the authoritative transform.
3987-
/// Owner clients can directly set the state on a server authoritative transform
3988-
/// This will override any changes made previously to the transform
3989-
/// This isn't resistant to network jitter. Server side changes due to this method won't be interpolated.
3990-
/// The parameters are broken up into pos / rot / scale on purpose so that the caller can perturb
3991-
/// just the desired one(s).
3992-
/// Using this method during the spawn sequence isn't recommended. Refer to the NetworkTransform documentation for more information on the recommended usage.
3983+
/// Directly sets a state on the authoritative transform. <br />
3984+
/// Owner clients can directly set the state on a server authoritative transform. <br />
3985+
/// This will override any changes made previously to the transform. <br />
3986+
/// This isn't resistant to network jitter. Authority side changes due to this method won't be interpolated when <paramref name="teleportDisabled"/> is false. <br />
3987+
/// Using this method during the spawn sequence isn't recommended. Refer to the NetworkTransform documentation for more information on the recommended usage. <br />
39933988
/// </summary>
39943989
/// <param name="posIn">new position to move to. Can be null</param>
39953990
/// <param name="rotIn">new rotation to rotate to. Can be null</param>
39963991
/// <param name="scaleIn">new scale to scale to. Can be null</param>
39973992
/// <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>
3998-
/// <exception cref="Exception">Thrown when the function is called on non-spawned object or, when it's called without proper authority</exception>
39993993
public void SetState(Vector3? posIn = null, Quaternion? rotIn = null, Vector3? scaleIn = null, bool teleportDisabled = true)
40003994
{
40013995
if (!IsSpawned)
@@ -4124,12 +4118,13 @@ private void SetStateServerRpc(Vector3 pos, Quaternion rot, Vector3 scale, bool
41244118
}
41254119

41264120
/// <summary>
4127-
/// Teleport an already spawned object to the given values without interpolating.
4128-
/// Using this method during the spawn sequence isn't recommended. Refer to the NetworkTransform documentation for more information on the recommended usage.
4121+
/// Teleport an already spawned object to the given values without interpolating.<br />
4122+
/// Using this method during the spawn sequence isn't recommended since the authority already teleports to the currently set transform values.<br />
41294123
/// </summary>
41304124
/// <remarks>
41314125
/// This is intended to be used on already spawned objects, for setting the position of a dynamically spawned object just apply the transform values prior to spawning.<br />
4132-
/// With player objects, override the <see cref="OnNetworkSpawn"/> method and have the authority make adjustments to the transform prior to invoking base.OnNetworkSpawn.
4126+
/// With player objects, override the <see cref="OnNetworkSpawn"/> method and have the authority make adjustments to the transform prior to invoking base.OnNetworkSpawn.<br />
4127+
/// When using an owner authority motion model and a client-server network topology, it is recommended to stick with the motion authority (as much as possible) when invoking this method. <br />
41334128
/// </remarks>
41344129
/// <param name="newPosition">new position to move to.</param>
41354130
/// <param name="newRotation">new rotation to rotate to.</param>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ private void OnDestroy()
17381738
if (!NetworkManager.ShutdownInProgress)
17391739
{
17401740
// Since we still have a session connection, log locally and on the server to inform user of this issue.
1741-
// If the NetworkObject's GaaeObject is not valid or the scene is no longer valid or loaded, then this was due to the
1741+
// If the NetworkObject's GameObject is not valid or the scene is no longer valid or loaded, then this was due to the
17421742
// unloading of a scene which is done by the authority...
17431743
if (gameObject != null && gameObject.scene.IsValid() && gameObject.scene.isLoaded)
17441744
{

0 commit comments

Comments
 (0)