Set Up the Unity SDK #

In this section, we’ll be generating a Unity SDK package, importing it into our project, and completing the initial configuration.

Prerequisites

Confirm correct SDK generation type #

In your pragma-engine/platform/pragma-cli.ini file, ensure the sdk type is set to unity:

company = mycompany
decrypter = passthrough
mvn_version_prefix = MNV_VERSION_PREFIX
project = myproject
project_dir_prefix = myproject
project_lib = myproject-lib
sdk = unity

Set up PragmaSDK for Unity #

  1. Copy the update-pragma-sdk.sh file from pragma-engine/sdk/unity into the root directory of your Unity project.

  2. Modify the copied update-pragma-sdk.sh script as follows:

    • Uncomment SOURCE_ENGINE_RELATIVE_FOLDER and change the value to point to your local Pragma Engine repo.
    • Uncomment TARGET_PRAGMA_SDK_DIR and change the path to "Assets/PragmaSDK".

    Copy update-pragma-sdk.sh into the root directory of your Unity project.

  3. Run update-pragma-sdk.sh in Git Bash. Confirm that the files in the Assets/PragmaSDK are updated.

Update PragmaSDK for Unity #

Whenever you make changes to Pragma Engine or update the code, you’ll want to update the PragmaSDK Unity plugin folder. Re-run the update script command from your project’s root directory:

update-pragma-sdk.sh

Configure the Pragma SDK #

Create a “Pragma.json” file in your project’s Assets folder and add the following:

{
    "backendAddress": "http://127.0.0.1:10000",
    "gameClientVersion": "DefaultGameClientVersion"
}
Game servers need to connect to the Partner (10100) port over HTTP. These requirements are enforced by the Pragma.Server session object.