Non-Unity games

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

Pley is primarily targeting help mobile games made in Unity; however, that doesn't mean that non-unity games are impossible. This article guides you through the process to use the Pley SDK for games not built in the Unity Engine.

Step 1: Get the Pley CLI & SDK

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

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

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

Step 2: Set up your project

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

  2. Run pley login to authorize with Pley. Enter your Pley developer credentials when prompted.

>  pley 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 pley init to initialize your project.
>  pley init
   navigate with [j] and [k] then press Enter to select
   select corresponding Pley web 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 Pley 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 Pley SDK package you downloaded earlier and click Import to add it to your game.

📘

Pley SDK initialization

The Pley 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/Pley/Resources/PleyConfig.asset

Step 3: Test in the Unity Editor

  1. Run pley dev in the command line to start a dev server that emulates the Pley platform locally.
>  cd path\to\my_unity_project
>  pley 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 Pley SDK has correctly initialized. Check that it has logged on the Unity console a similar to the one below: 🤞

pleysdk INF - Initializing, SDK version: 2.0.0-750a2917, Unity version: 2019.3.0, dev_host: "127.0.0.1:23000"
pleysdk INF - Connecting to dev host at ws://127.0.0.1:23000/play/7qq9QsqNHj...
pleysdk INF - Connected to dev host
pleysdk INF - Initialization successful
Pley 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 > Pley > Setup WebGL Build Settings. This will automatically apply the necessary WebGL build settings for your game to run on Pley.

  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 Pley. 👍

  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 pley builds upload \path\to\my_build.
> pley  builds upload -t <type-of-the-build> /path/to/build
  ✓  all files read                                                     
  ✓  build uploaded and queued for post-processing                      
                                                                       
> trail builds upload -t <type-of-the-build> /path/to/build
  ✓  all files read                                                     
  ✓  build uploaded and queued for post-processing                      
                                                                        
  ⓘ  visit https://manage.trail.gg for current status

📘

The type argument is recommended to be "unity" or "generic web".

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. 🏁

👍

Success!

You've successfully uploaded your game build to Pley! ✨
Now, it is time for you to 🌐 Release on Web.


What’s Next