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.
- Listed in Global namespace: P
- Inherits or implements
SingletonBehaviour<PlatformDriver> - Derived types
PlatformDriver
Constructors
| Member | What it is |
|---|---|
PlatformDriver() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
2 private and internal fields
| Member | What it is |
|---|---|
private static Logger logger | NLog logger for this class. |
private PlayerMode mode | Backing field for Mode. |
Properties
| Member | What 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
| Member | What it is |
|---|---|
static event PlatformModeHandler PlatformSet | Static event raised when Mode is set. |
Methods
| Member | What 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
| Member | What 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. |