Skip to main content

BudgetedUpdateModule

A class in Root.Township, the global namespace.

An UpdateModule with a time budget: each update runs registered methods until MsAllowance milliseconds pass, and the next update carries on from where it stopped.

Constructors​

MemberWhat it is
BudgetedUpdateModule(string name, float msAllowance, UpdateSegment segment, bool includeInServerProfiling = false)Creates a BudgetedUpdateModule from name, msAllowance, segment and includeInServerProfiling.

Fields​

3 private and internal fields
MemberWhat it is
private static bool isDebuggingAllowanceBacking field for IsDebuggingAllowance.
private bool isFirstTrue for the first method of an update, so at least one method always runs.
private float msAllowanceBacking field for MsAllowance.

Properties​

MemberWhat it is
static bool IsDebuggingAllowance { get; set; }Static switch: when on, the budget is ignored so every method runs, and usage time is recorded for profiling.
float MsAllowance { get; set; }Milliseconds per update the module may spend before stopping.

Methods​

MemberWhat it is
override IUnityUpdateMethod RegisterMethod(Action method)Adds a method to the module's circular list.
sealed override void Update()Runs methods from where the last update stopped until the budget is used, recording how long it took.
protected override void DeregisterMethod(UpdateModule.MethodNode node)Removes a method, clearing the list when it was the last one.
1 private and internal method
MemberWhat it is
private bool ProcessNode(UpdateModule.MethodNode node)Iteration check for each method: stops once the loop comes back around or the budget runs out, and remembers where to start next time.

Used in​

Members of other types that take, return or hold a BudgetedUpdateModule: