Build script without persistent artifacts
Hey there! I'm pretty new to Unity, but I've worked in many other engines before. I want to add a preprocessing step to my build that is executed at build-time, creating data that is accessible to the build. More concretely, I have a small map in a scene that I want to do a couple of things to:
1. Preprocess the map scene to create e.g. information on places where you can place buildings
2. Merge all the meshes/objects that make up the map to a single object+mesh
Now, I've found plenty of tutorials that show me how to add some button (or use e.g. AssetModificationProcessor to run it on saves) that runs a script that will let me do the stuff I want done, but this creates build artifacts (the preprocessed data + generated mesh) into my scene. There's several downsides to doing it this way:
1. You might forget to press the button
2. Derived data has to be checked to source control
3. Cluttering the scene + risk of mixing up derived and real data
Is there some way to run a build script right before running / building? I've found IPreprocessBuildWithReport, but it seems like it only runs when I build the game, not when I run via the "Play" button in the editor. Also, I'm not sure if I could use that to merge the scene meshes automatically.
Thanks!
Your answer
Follow this Question
Related Questions
Exporting to iOS from Windows 7 1 Answer
ShaderGraph shaders not working in builds 1 Answer
Adding C-preprocessor to build chain? 0 Answers
Extremely slow building of AssetBundles 0 Answers
Can only see canvas, skybox and particle systems in build 0 Answers