Struct NetworkTime
A struct to represent a point of time in a networked game. Time is stored as a combination of amount of passed ticks + a duration offset. This struct is meant to replace the Unity Time API for multiplayer gameplay.
Inherited Members
Namespace: Unity.Netcode
Assembly: solution.dll
Syntax
public struct NetworkTime
Constructors
| Name | Description |
|---|---|
| NetworkTime(uint) | Creates a new instance of the NetworkTime struct. |
| NetworkTime(uint, double) | Creates a new instance of the NetworkTime struct. |
| NetworkTime(uint, int, double) | Creates a new instance of the NetworkTime struct. |
Properties
| Name | Description |
|---|---|
| FixedDeltaTime | Gets the fixed delta time. This value is based on the TickRate and stays constant. Similar to fixedUnscaledTime There is no equivalent to deltaTime. |
| FixedTime | Gets he current fixed network time. This is the time value of the last network tick. Similar to fixedUnscaledTime. |
| Tick | Gets the amount of network ticks which have passed until reaching the current time value. |
| TickOffset | Gets the amount of time which has passed since the last network tick. |
| TickRate | Gets the tickrate of the system of this NetworkTime. Ticks per second. |
| Time | Gets the current time. This is a non fixed time value and similar to time. |
| TimeAsFloat | Gets the current time as a float. |
Methods
| Name | Description |
|---|---|
| TimeTicksAgo(int) | Returns the time a number of ticks in the past. |
| ToFixedTime() | Converts the network time into a fixed time value. |
Operators
| Name | Description |
|---|---|
| operator +(NetworkTime, double) | Computes the time a number of seconds later |
| operator +(NetworkTime, NetworkTime) | Computes the sum of two times |
| operator -(NetworkTime, double) | Computes the time a number of seconds before |
| operator -(NetworkTime, NetworkTime) | Computes the time difference between two ticks |