Build Profiles
A build profile is a saved description of one build of your project: the platform it exports to, whether it runs as a client or a dedicated server, its configuration and the script symbols its code compiles with. A project can keep several, such as a windowed client and a headless server built from the same scenes and scripts. The tutorial exports with Project → Export, which uses the active profile, or with no profile at all when the project has none.
The Build Profiles window
Open Project → Build Profiles… in Studio. The window lists the profiles the project registers, and selecting one shows its fields.
- Add Build Profile creates one. Its menu lists each installed platform with the targets it supports, such as Desktop Client and Desktop Server.
- One profile is the active profile. Switch Profile makes another one active. Build & Run, exports without a named profile and play mode follow the active one.
- A profile's Build button exports it. On a platform that installs on devices, Build & Run builds a development player and runs it on the selected device.
- Remove Profile takes a profile out of the project. Its asset file is kept for reuse.
Profiles are data assets in Assets/Settings/Build/, so they are versioned with the project.
What a profile holds
| Field | Meaning |
|---|---|
| Name | The name builds refer to it by, and the folder its export goes into. Empty uses the file name. |
| Platform | Where the game exports. desktop is the default: Windows, macOS and Linux. Other platforms come from editor bricks, such as Android. |
| Target | Client, a game a player runs with a window, renderer and input, or Server, a dedicated server that runs headless. |
| Configuration | Release (the default) ships optimized code without debug symbols. Debug keeps the symbols. |
| Runtime Identifier | The .NET runtime to publish for, such as linux-x64. Empty uses the machine that runs the export. Desktop offers win-x64, win-arm64, linux-x64, linux-arm64, osx-x64 and osx-arm64. |
| Development | Makes a development build, which defines DEVELOPMENT_BUILD whatever the configuration. |
| Native AOT | Compiles a desktop server ahead of time. See Dedicated Servers. |
| Scripting Defines | Extra script symbols, separated by semicolons. |
| Settings | Settings assets that replace the project's of the same kind, such as a server's own Player Settings. |
A profile's symbols are TURIAN_SERVER for a server target, DEVELOPMENT_BUILD for a development build, and then the scripting defines. Scripts branch on them with the usual preprocessor directives:
#if TURIAN_SERVER
Log.Logger.LogInformation("Dedicated server started; headless: {Headless}", Application.IsHeadless);
#else
Log.Logger.LogInformation("Client started; headless: {Headless}", Application.IsHeadless);
#endif
A server target leaves out the client-only bricks, such as the Vulkan renderer, and every brick that depends on one. Code that uses the renderer, the window or the in-game UI belongs in the client branch, or the server build fails.
The project asset: Assets/Project.dataasset
The project's entry point is Assets/Project.dataasset. Studio and the CLI keep it up to date, and it belongs in version control with the rest of Assets/. It records:
| Field | Meaning |
|---|---|
| Settings | The settings assets in force, one per kind. |
| BuildProfiles | The build profiles, in the order the window lists them. |
| ActiveBuildProfile | The profile Build & Run, exports without a name and play mode follow. Empty builds the plain project. |
| EngineVersion | The engine version that last saved the project, which decides whether it needs upgrading. |
A profile file is a data asset that holds its own fields, such as this dedicated server profile from the example-08-client-server example:
{
"__TypeId": "871cd819-cb92-4f78-a849-4a66309b3de6",
"Name": "Server",
"Platform": "desktop",
"Target": 1,
"RuntimeIdentifier": null,
"Configuration": 1,
"Development": false,
"ScriptingDefines": null,
"Settings": [],
"Id": "9b4e7c13-2d8f-4a61-b5c9-e3f1a7d2c064"
}
Target is 0 for Client and 1 for Server, and Configuration is 0 for Debug and 1 for Release.
Export from the command line
turian-cli export MyGame --profile Client --profile Server
turian-cli export MyGame
Each --profile names a profile to export, and the options can be repeated. Without one, the export uses the active profile, or the plain project when none is active. Every requested profile is checked before any of them is built, so a missing profile name or a bad setting fails before compilation starts. An unknown name lists the profiles that exist.
A named profile exports to Output/<profile name>/<game>/, so several profiles never overwrite each other. The export without a profile goes to Output/<game>/. The -c option sets the configuration only for an export without a profile, because a profile always uses its own Configuration. See the CLI reference for every export option.