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.
This tutorial can be run against either a new Unity project or a preexisting one. This tutorial uses Unity Engine 2021.3.
Create a new project (optional) #
Edit the Pragma SDK setup script #
Copy the setup script (
update-pragma-sdk.sh
) frompragma-engine/sdk/unity
into the root directory of your Unity project.Modify the
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"
.
- Uncomment
Run
update-pragma-sdk.sh
in Git Bash. Confirm that the files in thePragmaSDK
are updated.
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.
Edit player settings #
Open your Unity project.
From the File menu, choose Build Settings…, then click the Player Settings button.
Expand Other Settings, then scroll to the Script Compilation section. Under Scripting Define Symbols click the + button and add
PRAGMA_LOG_VERBOSE
, then click Apply. This enables full payload logging of all messages to and from the engine.
Additional setup is required for Unity 2022.1 and newer. Please see the following directions.