Struct NetworkTransform.NetworkTransformState
Data structure used to synchronize the Network
Implements
Inherited Members
Namespace: Unity.Netcode.Components
Assembly: Unity.Netcode.Runtime.dll
Syntax
public struct NetworkTransform.NetworkTransformState : INetworkSerializable
Properties
HasPositionChange
When set, at least one of the position axis values has changed.
Declaration
public bool HasPositionChange { get; }
Property Value
Type | Description |
---|---|
bool |
HasPositionX
When set, the X-Axis position value has changed
Declaration
public bool HasPositionX { get; }
Property Value
Type | Description |
---|---|
bool |
HasPositionY
When set, the Y-Axis position value has changed
Declaration
public bool HasPositionY { get; }
Property Value
Type | Description |
---|---|
bool |
HasPositionZ
When set, the Z-Axis position value has changed
Declaration
public bool HasPositionZ { get; }
Property Value
Type | Description |
---|---|
bool |
HasRotAngleChange
When set, at least one of the rotation axis values has changed.
Declaration
public bool HasRotAngleChange { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When quaternion synchronization is enabled all axis are always updated.
HasRotAngleX
When set, the Euler rotation X-Axis value has changed.
Declaration
public bool HasRotAngleX { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When quaternion synchronization is enabled all axis are always updated.
HasRotAngleY
When set, the Euler rotation Y-Axis value has changed.
Declaration
public bool HasRotAngleY { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When quaternion synchronization is enabled all axis are always updated.
HasRotAngleZ
When set, the Euler rotation Z-Axis value has changed.
Declaration
public bool HasRotAngleZ { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When quaternion synchronization is enabled all axis are always updated.
HasScaleChange
When set, at least one of the scale axis values has changed.
Declaration
public bool HasScaleChange { get; }
Property Value
Type | Description |
---|---|
bool |
HasScaleX
When set, the X-Axis scale value has changed.
Declaration
public bool HasScaleX { get; }
Property Value
Type | Description |
---|---|
bool |
HasScaleY
When set, the Y-Axis scale value has changed.
Declaration
public bool HasScaleY { get; }
Property Value
Type | Description |
---|---|
bool |
HasScaleZ
When set, the Z-Axis scale value has changed.
Declaration
public bool HasScaleZ { get; }
Property Value
Type | Description |
---|---|
bool |
InLocalSpace
When set, the Network
Declaration
public bool InLocalSpace { get; }
Property Value
Type | Description |
---|---|
bool |
IsSynchronizing
When set, this indicates it is the first state being synchronized.
Typically when the associate Network
Declaration
public bool IsSynchronizing { get; }
Property Value
Type | Description |
---|---|
bool |
IsTeleportingNextFrame
When set, the current state will be treated as a teleport.
Declaration
public bool IsTeleportingNextFrame { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When teleporting:
- Interpolation is reset.
- If using half precision, full precision values are used.
- All axis marked to be synchronized will be updated.
LastSerializedSize
The last byte size of the Network
Declaration
public readonly int LastSerializedSize { get; }
Property Value
Type | Description |
---|---|
int |
QuaternionCompression
When set Quaternions will be compressed down to 4 bytes using a smallest three implementation.
Declaration
public bool QuaternionCompression { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This only will be applied when Quaternion
- Quaternion Compression: 4 bytes per delta update
- Half float precision: 8 bytes per delta update
QuaternionSync
When enabled, this Network
Declaration
public bool QuaternionSync { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Use quaternion synchronization if you are nesting Network
UseHalfFloatPrecision
When set, the Network
Declaration
public bool UseHalfFloatPrecision { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Postion is synchronized through delta position updates in order to reduce precision loss/drift and to extend to positions beyond the limitation of half float maximum values.
Rotation and scale both use half float precision (Half
UseInterpolation
When set the Network
Declaration
public bool UseInterpolation { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Authority does not apply interpolation via Network
UsePositionSlerp
Determines if position interpolation will Slerp towards its target position. This is only really useful if you are moving around a point in a circular pattern.
Declaration
public bool UsePositionSlerp { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
GetNetworkTick()
The network tick that this state was sent by the authoritative instance.
Declaration
public int GetNetworkTick()
Returns
GetPosition()
Returns the current state's position. If there is no change in position, then it returns zero.
Declaration
public Vector3 GetPosition()
Returns
Remarks
When there is no change in an updated state's position then there are no values to return.
Checking for Has
GetRotation()
Returns the current state's rotation. If there is no change in the rotation, then it will return identity.
Declaration
public Quaternion GetRotation()
Returns
Type | Description |
---|---|
Quaternion |
Remarks
When there is no change in an updated state's rotation then there are no values to return.
Checking for Has
GetScale()
Returns the current state's scale. If there is no change in scale, then it returns zero.
Declaration
public Vector3 GetScale()
Returns
Remarks
When there is no change in an updated state's scale then there are no values to return.
Checking for Has
IsReliableStateUpdate()
Returns true if this state was sent with reliable delivery. If false, then it was sent with unreliable delivery.
Declaration
public bool IsReliableStateUpdate()
Returns
Type | Description |
---|---|
bool |
Remarks
Unreliable delivery will only be used if Use
IsUnreliableFrameSync()
Returns whether this state update was a frame synchronization when UseUnreliableDeltas is enabled. When set, the entire transform will be or has been synchronized.
Declaration
public bool IsUnreliableFrameSync()
Returns
Type | Description |
---|---|
bool |
NetworkSerialize<T>(BufferSerializer<T>)
Serializes this Network
Declaration
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
Buffer |
serializer |
Type Parameters
Name | Description |
---|---|
T |