Hi,
I have a build script, that’s called via menu from editor (Unity 2021.3.28f1):
[MenuItem("Build/Standalone build")]
static void Standalone()
{
InitPlayerSettings();
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows);
buildClient(false);
}
“InitPlayerSettings” saves build date and git repository information in “UnityEngine.Application.streamingAssetsPath” as “version.txt” and “repo.txt”, respectively.
Then it calls (maybe not necessary? seems, it doesn’t work here as intended) AssetDatabase.Refresh()
“buildClient” builds development (true) or release (false) via BuildPipeline.BuildPlayer(buildPlayerOptions)
Both version.txt and repo.txt are always rewritten in project StreamingAssets. But sometimes, only version.txt is updated in the build directory, while repo.txt isn’t (it stays as existing version if any - it’s copied, however, if there is no repo.txt in previous build).
Any idea why it behaves that way? AFAICT this is a bug.
It seems, with “BuildOptions.CleanBuildCache” it works as it should, but this is not a real solution because build takes unnecessarily longer.