TBServiceManager

A static wrapper class for interfacing platform services such as Steamworks and Oculus Platform. It currently supports entitlement check and achievements.

Note: This functionality is available in v1.1.0 and newer.

Overview

TBServiceManager adds support for the TBServices system to your game at runtime.

Dependencies

  • At least one platform is enabled in the Core Settings menu
  • A service is enabled in the Service Settings menu
  • The scene contains a TBCore object

Setup

Initialize TBServiceManager by calling TBServiceManager.Initialize() from one of your scripts at startup, or add the TBServiceManager script to the same object as TBCore.

Reference

Get the TButt namespace to reference TBServiceManager in your scripts.

using TButt;

Entitlement Check

By default, TBServiceManager will do an entitlement check when it initializes in your first scene, and call Unity’s Application.Quit() if it fails. To override this behavior, you can subscribe to the TBServiceManager.Events.OnEntitlementCheckComplete event and handle the fail case in your own function.

Status Checks

Function Description
VRService GetActiveService() Returns the active VRService.
bool IsReady() Returns true if the active service has finished initializing (and received startup callbacks if online).

User Data

You can get basic information about the logged in user. This will be expanded in the future.

Function Description
string GetUsername()) Returns the username of the logged in user.

Achievements

TBServiceManager uses a string token system to identify achievements. Use the same string tokens that you set up in the Oculus and Steamworks developer dashboards for your game.

Function Description
void UnlockAchievement(string token) Unlocks the requested achievement (if it is not already unlocked).
bool IsAchievementUnlocked(string token) Returns true if the requested achievement has been unlocked.
int GetNumAchievements() Returns the total number of achievements.
int GetNumAchievements(bool unlocked) Returns the number of unlocked (true) or locked (false) achievements.

Events

Event Description
TBServiceManager.Events.OnEntitlementCheckComplete(bool passed) Receives results of entitlement check. Subscribing to this event will override default entitlement check behavior (closing the application on fail).
TBServiceManager.Events.OnAchievementUnlocked(string token) Receives the string token for the achievement that was unlocked.