Set up the Unity SDK #
This tutorial involves setting up and integrating the Pragma Unity SDK. This includes generating the Pragma SDK sources, integrating it into an Unity project, initializing it, and logging in to the Pragma backend with a test user.
Prerequisites
Confirm correct SDK generation type #
In your pragma-engine/platform/pragma-cli.ini and pragma-engine/platform/pragma-cli-{project-name}.ini files, ensure the sdk type is set to unity:
sdk = unity
Set up the Pragma SDK for Unity #
Copy the
update-pragma-sdk.shfile frompragma-engine/sdk/unityinto the root directory of your Unity project.Modify the copied
update-pragma-sdk.shscript as follows:Uncomment
SOURCE_ENGINE_RELATIVE_FOLDERand change the value to point to your local Pragma Engine repo.- eg.
SOURCE_ENGINE_RELATIVE_FOLDER="../../pragma-engine"
- eg.
Uncomment
TARGET_PRAGMA_SDK_DIRand change the path to"Assets/PragmaSDK".
Stop pragma engine if it’s running locally.
Run
update-pragma-sdk.shin Git Bash. Confirm that the files in theAssets/PragmaSDKare updated.- Whenever you make changes to Pragma Engine or update the code, you’ll want re-run the update script from your project’s root directory to update the Pragma SDK.
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.