Tilt Five Unity SDK 1.4.2
Loading...
Searching...
No Matches
TiltFive.Player.WaitUntilPlayerConnected Class Reference

Suspends coroutine execution until the provided player has connected. More...

Inheritance diagram for TiltFive.Player.WaitUntilPlayerConnected:

Public Member Functions

 WaitUntilPlayerConnected (PlayerIndex playerIndex)

Properties

override bool keepWaiting [get]

Detailed Description

Suspends coroutine execution until the provided player has connected.

This custom yield instruction is useful for performing tasks that depend on a specific player being connected and initialized. This is a tidy alternative to repeatedly polling Player.IsConnected(PlayerIndex) in a loop or using UnityEngine.WaitUntil.

Let's assume that we've written a script that needs to cache the player's head pose root GameObject in a member variable for later use. The head pose root GameObject doesn't exist until the specified player connects and creates it during initialization, so we need to wait for the player to connect.

private IEnumerator Start() { // ... // We can do some other initialization here before we begin waiting. // ...

// Suspend this coroutine until the specified player has connected. yield return new Player.WaitUntilPlayerConnected(PlayerIndex.Two);

// Now that the player has connected, it is safe to obtain and store the player's head pose root GameObject. m_glassesPoseRoot = Glasses.GetPoseRoot(PlayerIndex.Two); }

Constructor & Destructor Documentation

◆ WaitUntilPlayerConnected()

TiltFive.Player.WaitUntilPlayerConnected.WaitUntilPlayerConnected ( PlayerIndex playerIndex)
inline

Property Documentation

◆ keepWaiting

override bool TiltFive.Player.WaitUntilPlayerConnected.keepWaiting
get

The documentation for this class was generated from the following file: