- Home /
Custom build variable
I'm trying to automace my build process using batchmode. Part of this process is to set internal version of application.
I tried following approach:
class BuildScript {
[UnityEditor.MenuItem("Builder/Build")]
static void Build() {
MyConstants.GAME_VERSION = "ver_1.2.3"
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneOSXIntel);
string res = BuildPipeline.BuildPlayer(scenes, path, BuildTarget.StandaloneOSXIntel, BuildOptions.None);
}
}
where MyConstants just a class with static variable.
But it seems that BuildPipeline executes new versions of code and all changes made in build script are lost.
Without defines with value ala C++ i can't find a way to set variable in code on build. Only way i found so far is to generate GameVersion.cs file with static variable inside every build by hand from build script, but that just too awful.
Is there a better way to accomplish this?
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Running Mac Standalone Player In Batchmode 1 Answer
Modify Assembly-CSharp.dll before send to IL2CPP 0 Answers
Modify Assembly-CSharp.dll before send to IL2CPP 0 Answers
How can I change Scripting Define Symbols before a command line batchMode executeMethod? 3 Answers