This CodeLab covers the steps to accessing the latest official Gameboard Unity SDK. The Gameboard Unity SDK exposes all the functionality unique to Gameboard in order to reduce the effort of creating games.

In order to access Gameboard libraries and packages you'll first need to install and configure AWS CLI Install or update the latest version of the AWS CLI - AWS Command Line Interface

Access Key ID: AKIAZHAA64DIFRMTECVF

Secret Access Key: 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

To consume the published package in UnityHub you have to:

1. Create Scoped Registry

Create an entry on the Project Settings -> Package Manager -> Scoped Registries section like in the following image:

Step-by-Step

2. Create Config Files

Create a .npmrc file under Assets with the following content. Note that <AUTH TOKEN> will be replaced in a future step.

registry=https://gameboard-libs-633509699792.d.codeartifact.us-east-1.amazonaws.com/npm/gameboard-external-npm/
//gameboard-libs-633509699792.d.codeartifact.us-east-1.amazonaws.com/npm/gameboard-external-npm/:always-auth=true
//gameboard-libs-633509699792.d.codeartifact.us-east-1.amazonaws.com/npm/gameboard-external-npm/:_authToken=<AUTH TOKEN>

Create a .upmconfig.toml file under location appropriate for your operating system with the following content. Note that <AUTH TOKEN> will be replaced in a future step.

[npmAuth."https://gameboard-libs-633509699792.d.codeartifact.us-east-1.amazonaws.com/npm/gameboard-external-npm/"]
token = "<AUTH TOKEN>"
alwaysAuth = true

NOTE: Both of these files need the . at the start of the file name. If not present, you will get an error related to invalid authentication credentials.

3. Set Auth Token

Get the authorization token by running command and replace the value of <AUTH TOKEN> in the files created above with the provided token.

aws codeartifact get-authorization-token --domain gameboard-libs --domain-owner 633509699792 --region us-east-1 --query authorizationToken --output text

IMPORTANT: The token expires every 12 hours so make sure to get a new token executing the command above daily.

Within Windows -> Package Manager pressing down in the arrow icon you will find an entry called My Registries. The displayName should be displayed below the author name (both defined in the package.json)

Step-by-Step

In some cases, My Registries might not appear (depending on which version of Unity you are using). If this is the case, you should be able to manually add the dependency to your manifest.json file, which should be locationed in the Packages folder.

  "dependencies": {
    "com.lastgameboard.unity.gameboardsdk": "3.0.0",
    ...
  }

After installing the package, find the Gameboard menu at the top of the unity header, and click "Add SDK" to add the Gameboard GameObject to your project:

Step-by-Step

For some things, you will want to wait for the Gameboard SDK to be initialized first. You can check if the Gameboard SDK is initialized by checking the IsInitialized property, and if it isn't yet you can subscribe to the GameboardInitializationCompleted event, so your method will be called right after initialization is completed.

private void Start()
{
    GameObject gameboardObject = GameObject.FindWithTag("Gameboard");
    var gameboard = gameboardObject.GetComponent<Gameboard>();

    if (gameboard.IsInitialized)
    {
        OnGameboardInitialization();
    }
    else
    {
        gameboard.GameboardInitializationCompleted += OnGameboardInitialization;
    }
}