Demo build: 150 kg goal, end screen, separate AppId and store assets
GC_DEMO define (ProjectBuilder GC_DEMO=1 / -demo) builds GrassCutterDemo.exe for app 5668050 with its own product name, version 0.1-demo and no achievements. Purchases lock after shipping 150 kg; a goal label and a thanks/wishlist card follow. Menu gets a DEMO badge and wishlist button. Store texts (12 languages) and DEMO-badged capsules for the demo page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -63,18 +63,27 @@ namespace GrassCutter.EditorTools
|
||||
// GC_BUILD_DIR builds somewhere else, so a copy of the game that is running doesn't lock the build
|
||||
// a development build also reports GPU and render-thread frame times (FrameTimingManager), for -demoperf
|
||||
PlayerSettings.enableFrameTimingStats = CommandLineHas("-devbuild");
|
||||
var dir = Environment.GetEnvironmentVariable("GC_BUILD_DIR") is string d && d.Length > 0 ? d : "Builds/GrassCutter";
|
||||
// GC_DEMO=1 builds the demo: its own app, name (so its own saves and settings) and folder
|
||||
bool demo = Environment.GetEnvironmentVariable("GC_DEMO") == "1" || CommandLineHas("-demo");
|
||||
var dir = Environment.GetEnvironmentVariable("GC_BUILD_DIR") is string d && d.Length > 0 ? d : demo ? "Builds/GrassCutterDemo" : "Builds/GrassCutter";
|
||||
var opts = new BuildPlayerOptions
|
||||
{
|
||||
scenes = new[] { ScenePath },
|
||||
locationPathName = dir + "/GrassCutter.exe",
|
||||
locationPathName = dir + "/" + (demo ? "GrassCutterDemo.exe" : "GrassCutter.exe"),
|
||||
target = BuildTarget.StandaloneWindows64,
|
||||
options = CommandLineHas("-devbuild") ? BuildOptions.Development : BuildOptions.None,
|
||||
extraScriptingDefines = demo ? new[] { "GC_DEMO" } : null,
|
||||
};
|
||||
var report = BuildPipeline.BuildPlayer(opts);
|
||||
string name = PlayerSettings.productName;
|
||||
if (demo) PlayerSettings.productName = "Grass Cutters Together Demo";
|
||||
UnityEditor.Build.Reporting.BuildReport report;
|
||||
try { report = BuildPipeline.BuildPlayer(opts); }
|
||||
finally { PlayerSettings.productName = name; }
|
||||
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
throw new Exception("Build failed: " + report.summary.result);
|
||||
File.Copy("steam_appid.txt", dir + "/steam_appid.txt", true);
|
||||
// only for our own runs: never upload it to Steam (with it the game skips the Steam ownership check)
|
||||
if (demo) File.WriteAllText(dir + "/steam_appid.txt", "5668050");
|
||||
else File.Copy("steam_appid.txt", dir + "/steam_appid.txt", true);
|
||||
Debug.Log($"[Builder] Player built: {report.summary.totalSize / (1024 * 1024)} MB");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user