Non-Unity games

If your game is built using a different game engine than Unity, you can follow this guide.

Step 1: Get the Trail CLI & SDK

Before we get started, let's download the Trail CLI and SDK:

  • Trail CLI: a command-line tool that allows you to run your game builds locally and upload them to the Trail Dev Area.
  • Trail SDK: a library that enables communication with Trail.

Find the latest versions of these and installation instructions for the Trail CLI on the downloads page in the Game Manager (developer access required).

Step 2: Set up your Unity project

  1. Launch your command line (i.e. the Command Prompt or Terminal).

  2. Run trail login to authorize with Trail. Enter your Trail developer credentails when prompted.

>  trail login
   e-mail: [email protected]
   password: **********
βœ“  log in successful
>  trail login
   e-mail: [email protected]
   password: **********
βœ“  log in successful
  1. cd into the directory of your Unity project:
>  cd path\to\my_unity_project
>  cd path/to/my_unity_project
  1. Run trail init to initialize your project.
>  trail init
   navigate with [j] and [k] then press Enter to select
   select corresponding Trail game:
   > Example Game
βœ“  game 'Example Game' successfully initialized
>  trail init
   navigate with [j] and [k] then press Enter to select
   select corresponding Trail game:
   > Example Game
βœ“  game 'Example Game' successfully initialized
  1. Time to import the Trail SDK into your game. Begin by launching Unity and opening your game project.

  2. In Unity, go to Assets > Import Package > Custom Package…. Locate and select the Trail SDK package you downloaded earlier and click Import to add it to your game.

πŸ“˜

Trail SDK initialization

The Trail SDK is automatically initialized when your game starts up. However, if you would rather have more precise control of when the SDK initializes, you can also disable the automatic initialization and explicitly call the Init method whenever it makes sense for your game.

To disable the SDK automatic initialization uncheck the Initialize SDK At Startup option in the Assets/Trail/Resources/TrailConfig.asset

Step 3: Test in the Unity Editor

  1. Run trail dev in the command line to start a dev server that emulates the Trail platform locally.
>  cd path\to\my_unity_project
>  trail dev
β“˜  listening on 23000
>  cd path/to/my_unity_project
>  trail dev
β“˜  listening on 23000

🚧

Note

Without the dev server running, the SDK will fail to initialize when you run your game in the Unity Editor.

  1. Run your game in the editor.

  2. Confirm that the Trail SDK has correctly initialized. Check that it has logged on the Unity console a similar to the one below: 🀞

trailsdk INF - Initializing, SDK version: 2.0.0-750a2917, Unity version: 2019.3.0, dev_host: "127.0.0.1:23000"
trailsdk INF - Connecting to dev host at ws://127.0.0.1:23000/play/7qq9QsqNHj...
trailsdk INF - Connected to dev host
trailsdk INF - Initialization successful
Trail SDK init succeeded
  1. Excellent! πŸ‘Œ Time to make a build.

Step 4: Build, upload & play

In the Unity Editor, do the following:

  1. Go to File > Build Settings and make sure WebGL is the selected platform.

  2. Go to Window > Trail > Setup WebGL Build Settings. This will automatically apply the necessary WebGL build settings for your game to run on Trail.

  3. Time to make your build! Go to File > Build Settings > Build.

If everything goes well your build should look something like this:

\path\to\my_build
  β”œβ”€β”€ Build
  β”‚Β Β  β”œβ”€β”€ my_build.data.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.json
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.code.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.framework.unityweb
  β”‚Β Β  └── UnityLoader.js
  β”œβ”€β”€ TemplateData
  └── index.html
/path/to/my_build
  β”œβ”€β”€ Build
  β”‚Β Β  β”œβ”€β”€ my_build.data.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.json
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.code.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.framework.unityweb
  β”‚Β Β  └── UnityLoader.js
  β”œβ”€β”€ TemplateData
  └── index.html

All that is left now is to upload your build to Trail. πŸ‘

  1. Return to the command line and make sure you’re still in the directory of your Unity project:
>  cd path\to\my_unity_project
>  cd path/to/my_unity_project
  1. Run trail builds upload \path\to\my_build.
>  trail builds upload \path\to\my_build
  βœ“  all files read                                                     
  βœ“  build uploaded and queued for post-processing                      
                                                                        
  β“˜  visit https://manage.trail.gg for current status
>  trail builds upload /path/to/my_build
  βœ“  all files read                                                     
  βœ“  build uploaded and queued for post-processing                      
                                                                        
  β“˜  visit https://manage.trail.gg for current status

Once the upload is completed, your build will appear in the Builds section of the Game Manager (developer access required). You can run the build right away, even if post-processing has not yet finished. 🏁

Build, Upload & Play

In the Unity Editor, do the following:

  1. Go to File > Build Settings and make sure WebGL is the selected platform.

  2. Go to Window > Trail > Setup WebGL Build Settings. This will automatically apply the necessary WebGL build settings for your game to run on Trail.

  3. Time to make your build! Go to File > Build Settings > Build.

If everything goes well your build should look something like this:

\path\to\my_build
  β”œβ”€β”€ Build
  β”‚Β Β  β”œβ”€β”€ my_build.data.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.json
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.code.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.framework.unityweb
  β”‚Β Β  └── UnityLoader.js
  β”œβ”€β”€ TemplateData
  └── index.html
/path/to/my_build
  β”œβ”€β”€ Build
  β”‚Β Β  β”œβ”€β”€ my_build.data.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.json
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.code.unityweb
  β”‚Β Β  β”œβ”€β”€ my_build.wasm.framework.unityweb
  β”‚Β Β  └── UnityLoader.js
  β”œβ”€β”€ TemplateData
  └── index.html

All that is left now is to upload your build to Trail. πŸ‘

  1. Return to the command line and make sure you’re still in the directory of your Unity project:
>  cd path\to\my_unity_project
>  cd path/to/my_unity_project
  1. Run trail builds upload \path\to\my_build.
>  trail builds upload \path\to\my_build
  βœ“  all files read                                                     
  βœ“  build uploaded and queued for post-processing                      
                                                                        
  β“˜  visit https://manage.trail.gg for current status
>  trail builds upload /path/to/my_build
  βœ“  all files read                                                     
  βœ“  build uploaded and queued for post-processing                      
                                                                        
  β“˜  visit https://manage.trail.gg for current status

Once the upload is completed, your build will appear in the Builds section of the Game Manager (developer access required). You can run the build right away, even if post-processing has not yet finished. 🏁