TBCore

A manager for all of TButt’s scripts, required in every scene.

Overview

TBCore handles platform and lifecycle events, and drives the rest of TButt’s scripts.

Dependencies

  • At least one platform is enabled in the Core Settings menu

Setup

Create an empty GameObject and add a TBCore script to it. You must have a TBCore object in every scene.

Note: The TBCore object will persist between scenes. If a new TBCore instance is detected when going into a scene, the new instance will be removed. You can make your TBCore object into a prefab if you’d like, but it is not required.

Reference

Get the TButt namespace to reference TBCore in your scripts.

using TButt;

Reading Hardware / Platform Settings

You can get information about the player’s active hardware and environment with the following functions:

Function Description
VRPlatform GetActivePlatform() Returns the platform SDK / plugin in use. Options: None OculusPC SteamVR OculusMobile Daydream WindowsMR
VRHeadset GetActiveHeadset() Returns the active headset in use. Options: None OculusRift GearVR Oculus Go OculusQuest HTCVive WindowsMR Daydream MirageSolo

Example usage:

switch(TBCore.GetActivePlatform())
{
    case VRPlatform.SteamVR:
        break;
    case VRPlatform.OculusMobile:
    case VRPlatform.Daydream:
        break;
    case VRPlatform.OculusPC:
        break;
}

switch (TBCore.GetActiveHeadset())
{
    case VRHeadset.OculusQuest:
        break;
    case VRHeadset.OculusRift:
        break;
    case VRHeadset.OculusGo:
    case VRHeadset.GearVR:
    	break;
}

Protip: Use GetActivePlatform for platform functions, like if you need to show a “Quit” button on your main menu on one platform but not another. Use GetActiveHeadset() for hardware functions, like tutorials where you want to show art of a specific headset, or adjusting color settings for specific displays.

Events

The following platform and hardware lifecycle events can be subscribed to through TBCore.Events:

Event Description
OnHMDMounted(bool on) Fires with true/false when the headset is mounted or unmounted.
OnSystemMenu(bool on) Fires with true/false the system menu is entered / exited.
OnSystemSuspend Fires when the system menu is entered.
OnSystemResume Fires when returning from a system menu.
OnTrackingReset Fires when tracking is reset through TBCore’s recenter function.