Skip to main content

DynamicPhysicsTimeSet

A class in Root.Township, Alta.Utilities.

Server: scales the physics fixed timestep with server FPS, between the minimum and maximum physics rates in the server settings. ServerHandler starts it.

Constructors​

1 private and internal constructor
MemberWhat it is
private DynamicPhysicsTimeSet()Creates a DynamicPhysicsTimeSet with default values.

Fields​

4 private and internal fields
MemberWhat it is
private float nextUpdateReal time of the next adjustment.
private ServerSettings settingsThe current server settings.
private IUnityUpdateMethod updateHandle for the registered update method.
private const float UpdateIntervalSeconds between adjustments (5).

Methods​

MemberWhat it is
static void Start()Creates the instance, which hooks server settings changes and server end.
4 private and internal methods
MemberWhat it is
private void Disable()Sets the fixed timestep to the maximum physics frames per second and unregisters the update.
private void SettingsChanged(Settings settings)Re-reads the server settings and turns the update on or off by IsUpdatingPhysicsFixedFrameCount.
private void Stop()Runs when the server ends: unhooks the events and calls Disable.
private void Update()Every 5 seconds, maps current FPS between the two FPS settings onto a physics rate and sets Time.fixedDeltaTime.