I finally found a good and clean solution:
-
Create YourGameDemo.Target.cs (besides YourGame.Target.cs). It should inherit from YourGame.Target.cs
-
Add to the constructor of YourGameDemo.Target.cs
bOverrideBuildEnvironment = true; GlobalDefinitions.Add("DEMO_BUILD=1");
-
Write a IsDemo Function in a blueprint library, so you can check for demo everywhere.
static bool IsDemo()
{
#ifdef DEMO_BUILD
return true;
#else
return false;
#endif
}
- Use IsDemo checks where you need (show demo banner, lock specific full game functions etc.)
Can be used for other builds to (e.g. EGS build, GOG build and whatnot)