Simple question, what is the fastest and easiest way to build for multiple platforms?
Steps to success:
- select the platform
- press build
- repeat
If I just switch the target so many things are gonna break.
That’s not my experience. I just switch and go. Are you using platform-specific features or APIs?
This is all extremely well-traveled ground:
No but doesn’t it take like 10 minutes to even switch anyways?
Rather than fantasizing darkly about how the world will end when you flip build targets, why not flip them and see?
My experience is that changing targets takes anywhere from 10-20 seconds for an empty project up to ten hours for a massive project. Odds are your project lies somewhere in there, probably closer to the one minute mark.
Usually the slowest target is iOS when switching, and the slowest target to actually build is either Android or WebGL. But again, your mileage will almost certainly vary.
And of course if it is just too onerous to wait each time, then check out multiple copies of it from source control (you ARE using source control, right?) and keep each one built to a different target.
Or buy two computers.
Or a faster computer.
It’s just a project. It’s just folders. It’s just data. Work with it professionally.
I don’t recommend building for any other platform than the currently active one. You’ll run into issue where build code is compiled conditionally and the code for the wrong platform will run (e.g. build code using UNITY_IOS will not run if your active platform is Android and UNITY_ANDROID code will run instead). This is the case for some of Unity’s own packages as well.
So you’ll always want to first switch platforms and then do the build. You can do it manually or automate it using code, though the latter is a bit tricky due to the domain reloads during platform switching.
You can’t build for another platform other than the currently active one. You must switch platforms to build to a different platform, of course.
Ah, yeah, you can’t do it with the build window but there’s nothing stopping you from doing it with BuildPipeline.BuildPlayer
.
Are you talking about code I may have
Thanks never even knew you could do that.