Using Services

Note: Use of platform services through TButt is completely optional. Only available in v1.1.0 and newer.

TButt includes a basic service wrapper called “TBServiceManager” that handles basic features like authentication (entitlement checks) and achievements across services like Steamworks and Oculus Platform.

Setup

Create app entries on platform portals

Create an entry for your game on the app submission portal of your desired platform(s) and proceed with the process until you are assigned an app ID.

Install SDKs if necessary

In Unity, go to the “TButt” menu on the top menu bar and choose “Service Settings…”. If the service you want to use requires an external SDK or plugin to use, you’ll be prompted to download it in the Service Settings menu if TButt doesn’t detect it in your project. The download button in the menu will link to the most recent version that has been tested with TButt (although newer versions may also be compatible).

Add TBServiceManager

Add a TBServiceManager component to your TBCore object, or call TBServiceManager.Initialize() from one of your own scripts at startup.

image-center

Enter app IDs

In the “Service Settings…” menu, enter the app ID for your game provided by each platform you intend to support, and enable whichever one you want to work with for now.

image-center

Note: Unlike in Core Settings where you can enable multiple SDKs at once, you can have one service enabled at any given time. This is by design, so that your game only commuciates with one service’s servers at a time.

Entitlement Check

If the service supports entitlement check, TBServiceManager will run when it initializes and close the application if it fails. Look at the TBServiceManager scripting reference for information on overriding this default behavior.

Achievements

TButt uses a string token system to identify achievements. Use the same string tokens you created when setting up your achievements on the platform side.

Example

To unlock an achievement, pass an achievement’s string token into the UnlockAchievement function:

if(playerDidTheThing)
{
	TBServiceManager.UnlockAchievement("DID_THE_THING");
}

You don’t need to check if the achievement has already been unlocked before calling this. You may want to create a static class with all your string tokens to make them type safe, but it’s not required.

Additional Options

See the TBServiceManager reference for additional features like reading a player’s username, or getting a list of all your achievements at runtime.

Supported Platform Services

TButt currently supports the following features on each platform service:

Service Entitlement Check Achievements
Oculus Yes Yes
Steamworks Yes Yes