Struct NetworkTick
A simple struct used to represent a network tick. This is using a uint internally, but it has special logic to deal with invalid ticks, and it handles wrap around correctly.
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: solution.dll
Syntax
[Serializable]
public struct NetworkTick : IEquatable<NetworkTick>
Constructors
Name | Description |
---|---|
Network |
Constructor, the start tick can be 0. Use this instead of the default constructor since that will generate an invalid tick. |
Properties
Name | Description |
---|---|
Invalid | A value representing an invalid tick, this is the same as 'default' but provide more context in the code. |
Is |
Check if the tick is valid. Not all operations will work on invalid ticks. |
Serialized |
The serialized data for a tick. Includes both validity and tick index. |
Tick |
Get the tick index assuming the tick is valid. Should be used with care since ticks will wrap around. |
Tick |
Helper property to enable exception-free visibility in the Entity Inspector |
Methods
Name | Description |
---|---|
Add(uint) | Add a delta to the tick, assumes the tick is valid. |
Decrement() | Decrement the tick, assumes the tick is valid. |
Equals(object) | Compare two ticks, also works for invalid ticks. |
Equals(Network |
Compare two ticks, also works for invalid ticks. |
Get |
Get a hash for the tick. |
Increment() | Increment the tick, assumes the tick is valid. |
Is |
Check if this tick is newer than another tick. Assumes both ticks are valid. |
Subtract(uint) | Subtract a delta from the tick, assumes the tick is valid. |
Ticks |
Compute the number of ticks which passed since an older tick. Assumes both ticks are valid. If the passed in tick is newer this will return a negative value. |
To |
Convert the tick to a fixed string. Also handles invalid ticks. |
Operators
Name | Description |
---|---|
operator ==(in Network |
Compare two ticks, also works for invalid ticks. |
operator !=(in Network |
Compare two ticks, also works for invalid ticks. |