Home

Awesome

Netick TickTimer

Netick is a state transfer Unity netcode. This TickTimer is inspired by Photon Fusion TickTimer

TickTimer is a plugin wrapper that counts if the tick we are targeting has been passed rather than decrementing a float with deltaTime.

How to Use?

[Networked] private TickTimer _destroyTimer { get; set; }
private float _delay = 5f;

public override void NetworkStart()
{
    _destroyTimer = TickTimer.CreateFromSeconds(Sandbox, _delay);
}

public override void NetworkFixedUpdate()
{
    if (_destroyTimer.IsExpired(Sandbox))
    {
        _destroyTimer = TickTimer.None;
        Sandbox.Destroy(Object);
    }
}

TickTimer vs AuthTickTimer vs PauseableTickTimer

TimersDescription
TickTimerUses predictive tick if available. Most recommended way to sync timers
AuthTickTimerUses the server tick. Good for non-predictive stuff
PauseableTickTimerCan be paused across the network

API Reference

APIDescription
IsRunningHas a valid Target Tick
IsExpiredHas passed the target Tick
IsExpiredOrNotRunningEither Has passed the target Tick or it wasn't set
GetAlphaGet the progress to the target tick
GetAlphaClamedGet the progress to the target tick (clamped to 1)