- Home /
Force ImportAsset before Build?
During our build process, we write to a text file in the resources directory that lists the current build number of our game.
Whenever the build is finished, the data being read in through a Resources.Load() is always the previous version of the text file.
Here is my current order of operations:
IncrementBuildVersion();
AssetDatabase.ImportAsset("Resources/AppInfo/build_info.txt", ImportAssetOptions.ForceSynchronousImport);
BuildPipeline.BuildPlayer(scenes, buildLocation + buildFile, target, options);
In IncrementBuildVersion(), I'm writing to the file with a TextWriter, and am both using Close() and Dispose() on the file.
It seems as if the ImportAsset is delaying until after the build completes.
Any help is appreciated.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091805im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Can't use BuildFile.path. 0 Answers
Multiple Cars not working 1 Answer
Disable JIT compilation in the Editor (Enable Full-AOT mode) 0 Answers
ArgumentException: Input Key named: LeftAlt is unknown 2 Answers