Skip to main content

PlatformDriver

A class in Root.Township, the global namespace.

Singleton that starts and runs the active XR or flat device controller for the chosen player mode, and forwards Unity updates to it. Client-side.

Constructors​

MemberWhat it is
PlatformDriver()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for this class.
private PlayerMode modeBacking field for Mode.

Properties​

MemberWhat it is
IXrDeviceSdkController ActiveDevice { get; private set; }The device controller in use, or null before a platform starts.
PlayerMode Mode { get; set; }The current player mode. Setting it raises PlatformSet first.

Events​

MemberWhat it is
static event PlatformModeHandler PlatformSetStatic event raised when Mode is set.

Methods​

MemberWhat it is
IEnumerator SetupPlatform(PlayerMode newMode, IPlatformPlayer player) (iterator)Starts the platform for the mode if none is running, then gives the device its player.
void StopActivePlatform()Stops the active device and sets the mode back to unassigned.
5 private and internal methods
MemberWhat it is
private void FixedUpdate()Forwards FixedUpdate to the active device.
private void LateUpdate()Forwards LateUpdate to the active device.
private Coroutine StartPlatform(PlayerMode newMode, IPlatformPlayer player)Starts StartPlatformCoroutine as a coroutine.
private IEnumerator StartPlatformCoroutine(PlayerMode newMode, IPlatformPlayer player) (iterator)Creates the device controller for the mode, waits for the platform device, then starts it. Refuses to swap modes.
private void Update()Forwards Update to the active device.