Hello,
I have a custom build pipeline where I run BuildPipeline.BuildPlayer but I’m wondering if there’s a way to also run the build from code using the Editor’s functionality for it?

Kind regards,
Erik
Hello,
I have a custom build pipeline where I run BuildPipeline.BuildPlayer but I’m wondering if there’s a way to also run the build from code using the Editor’s functionality for it?

Kind regards,
Erik
depends a little on your target but the answer should be yes. I wrote a thing to run last build for webgl, including firing up the webserver … because sometimes you’re working and want to go back in to remind yourself exactly the other thing you saw… and dont want to rebuild, do most of a run through just to get it
No official way, no.
Nowadays, incremental builds can be very quick if you haven’t changed any assets/scripts, so maybe Build And Run isn’t too bad?
Internally, the code seems to go through the static method PostprocessBuildPlayer.Launch, which you could try calling using reflection. The method takes a BuildReport, don’t know if it’ll work with null or maybe you’ll have to cache the report from the last build.
Store the path you are building to in your custom build pipeline (or using a OnPostprocessBuild hook) and just … start the executable?
yep, long as its not android or such. It should be very doable if its something you can run on your current machine
I’ll ask out of curiosity I have no idea if this is possible. If you develop for android you have the path to the android sdk anyway either in unity or in some editor prefs, I know there was an android emulator in the sdk. Could you start an emulator and launch the apk directly inside of that emulated android device?
Or… write a simple adb script to check if there are devices attached, push the apk, launch the application - and execute that script from inside unity? I remember writing such a script ~5 years ago on an android project to install an apk after building on 4 devices at once (multiplayer game)
you can probably do an adb run script. but its been a long time since i went anywhere near there, so dunno if thats still the right thing