Skip to main content

GeneralLoadingObjectManager

A class in Root.Township, Alta.UserAuthentication.

Runs the loading scene: tracks the headset, sets flat lighting, spins a frame and cycles loading tips. Client only. DisplayMessage shows a message to the player there.

Constructors​

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

Fields​

16 private and internal fields
MemberWhat it is
private Color ambientColorAmbient light colour in the loading scene.
private Transform cameraTransformCamera that follows the headset.
private TextRenderer customMessageTextRendererText that DisplayMessage writes to.
private static GeneralLoadingObjectManager instanceThe current loading scene manager.
private static bool isInstanceInitializedTrue once a loading scene has started. It is never set back to false.
private bool isTransformToRotateNullTrue if there is no transform to spin.
private static readonly Logger loggerLogger for this class.
private float rotationSpeedSpin speed of the frame in degrees per second.
private CancellationTokenSource tipCancellationTokenSourceCancels the tip loop; nothing cancels it in this build.
private float tipDurationSecondsHow long each tip shows.
private int tipIndexIndex of the tip shown.
private string[] tipsThe tip texts, shuffled on start.
private TextRenderer tipTextRendererText that shows the tips.
private const int ToMilliseconds1000, for turning seconds into milliseconds.
private Transform transformToRotateThe object that spins.
private VRTrackedDevice vrTrackedDeviceHeadset tracking for the camera.

Methods​

MemberWhat it is
static void DisplayMessage(string message)Shows a message on the loading scene's custom message text. Logs a warning if no loading scene has started yet.
14 private and internal methods
MemberWhat it is
private void Awake()Calls InitializeLoadingScene.
private void CacheTransformToRotateNullComparison()Warns and remembers if there is no transform to spin, so Update can skip it cheaply.
private void CreateInstance()Stores this as the static instance.
private void InitializeLoadingScene()Sets up tracking, lighting, reflections and the static instance.
private void InitializeTips()Shuffles the tips and starts cycling them.
private void LateUpdate()Sets the ambient light again every frame.
private void OnDestroy()Stops the headset tracking. The tip loop is not cancelled.
private void SetAmbientLight()Sets flat ambient lighting in ambientColor.
private static void SetReflections()Sets custom reflections with no cubemap.
private void SetTrackedDevice()Makes the camera follow the headset.
private void Start()Calls InitializeTips.
private void Update()Spins the frame.
private void UpdateFrameRotation()Turns transformToRotate around the up axis by rotationSpeed degrees per second.
private async void UpdateTipText(CancellationToken cancellationToken)Shows each tip for tipDurationSeconds, looping until cancelled.