Class TimeoutHelper
Can be used independently or assigned to WaitForConditionOrTimeOut(Func<bool>, TimeoutHelper) in the event the default timeout period needs to be adjusted
Inherited Members
Namespace: Unity.Netcode.TestHelpers.Runtime
Assembly: Unity.Netcode.Runtime.Tests.dll
Syntax
public class TimeoutHelper
Constructors
TimeoutHelper(float)
Constructor that provides an optional float parameter to define the time out period.
Declaration
public TimeoutHelper(float timeOutPeriod = 2)
Parameters
| Type | Name | Description |
|---|---|---|
| float | timeOutPeriod | Optional float to define the time out period. It defaults to k_DefaultTimeOutWaitPeriod. |
Fields
k_DefaultTimeOutWaitPeriod
The default time out value.
Declaration
protected const float k_DefaultTimeOutWaitPeriod = 2
Field Value
| Type | Description |
|---|---|
| float |
Properties
TimedOut
Will be true if a timeout occurred or false if a timeout did not occur.
Declaration
public bool TimedOut { get; }
Property Value
| Type | Description |
|---|---|
| bool |
m_IsStarted
true If a timed conditional check has started and false if it has yet to start.
Declaration
protected bool m_IsStarted { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
GetTimeElapsed()
Gets the time that has passed since started.
Declaration
public float GetTimeElapsed()
Returns
| Type | Description |
|---|---|
| float | float as the time that has passed. |
HasTimedOut()
Invoke to determine if it has timed out.
Declaration
public bool HasTimedOut()
Returns
| Type | Description |
|---|---|
| bool | true or false |
OnHasTimedOut()
Virtual method returns true or false if timed out.
Declaration
protected virtual bool OnHasTimedOut()
Returns
| Type | Description |
|---|---|
| bool | true or false |
Remarks
Overriding this provides additional conditions to determine if it has timed out.
OnStart()
Virtual method to override in order to setup a derived class when started.
Declaration
protected virtual void OnStart()
OnStop()
Virtual method to override in order to clean up or other related logic when stopped.
Declaration
protected virtual void OnStop()
Start()
Invoke to start.
Declaration
public void Start()
Stop()
Invoke to stop.
Declaration
public void Stop()