Building for MacOS/iOS from Windows?

Started by Kryzon, March 13, 2022, 19:52:36

Previous topic - Next topic

Kryzon

Hi guys,

just for academic interest, is there a way to build MacOS and iOS games using Unity, from a Windows host machine?

I'm assuming you'd ask Unity to generate an XCode project, and from then on you don't need Unity anymore, just the XCode project
and a working XCode environment (running under the Windows host).

Xaron

You need a Mac OS system, there is no way around it.

But you can use the Hackintosh solution. VMWare player + MacOS running under Windows. Don't expect stellar performance but it's enough for building stuff with XCode. You cannot run 3d accelerated apps though.

Jayenkai

It's a costly endeavour.  And as much as "Hackintosh" kinda works, with all the M1 switchover and such, it's not exactly a stable way to do it.  There's bound to be more complications than you'd expect.
I couldn't tell you how many times I've coded things using an emulator, only to run it on the actual device and have it fail spectacularly..

The cheapest solution is a MacMini, but even that's the higher end of half-a-grand.  .. And that's assuming you have a keyboard/mouse/monitor to go with it. (Standard PC ones will do, but watch out for that Ctrl-Alt switchover)

You also need to pay for the annual Developer Fee, too.

Is it worth it?  Maybe.
Will you get your money back?   Only if your game's popular.
But nowadays it has to be REALLY popular, and it's so much harder to make your cash back just from simple app sales.  You have to faff about with IAP's and other gubbins.
I made about a grand from the sales of SpikeDislike, but that was over a decade ago.  Little "bit-games" like mine aren't going to make anywhere near that kind of cash, any more.
Build big, build great, and maybe you might find it's worth it.  But you have to make that leap, first, if you're going to get anywhere.

Good luck.
"Load, Next List"

Kryzon

#3
Thanks for the advice guys.

I was hoping it could be done mostly for free with a VMWare/VirtualBox + MacOS image, but if you're saying it's not reliable... I'll look into using some cloud/remote desktop solution, something that comes with XCode properly set up.

Edit: maybe something like this: https://www.scaleway.com/en/hello-m1/ (0.1 Euro per hour, there must be a catch I'm missing...)

Derron

github actions gives you access to kind of virtual macs - yet you need to handle the dev licence stuff on your own (if you do not just want to have it compiled "for friends/devs").

I use it to auto compile TVTower for Linux, Mac and Windows.

bye
Ron

Kryzon

Quote from: Derron on March 15, 2022, 09:09:28
github actions gives you access to kind of virtual macs - yet you need to handle the dev licence stuff on your own (if you do not just want to have it compiled "for friends/devs").

I use it to auto compile TVTower for Linux, Mac and Windows.
From what I'm reading, you can open a private repo and run a "MacOS XCode building" Github Action on it, all from a free account.
That sounds amazing Ron, I'll look into it.

Qube

QuoteI'm assuming you'd ask Unity to generate an XCode project, and from then on you don't need Unity anymore, just the XCode project
and a working XCode environment (running under the Windows host).
It doesn't work like that. Unity builds the app directly for MacOS and you can choose ARM, X64 or universal build which includes both. The MacOS version of Unity can also build for Windows and Linux.

As others have said you can just about get away with VMWare player + unlock tools ( to allow for MacOS ) and of course a MacOS installation ISO. Such things are against Apple's EULA so you'd have to Google for instructions rather than have a tutorial posted here :-X

It's perfectly feasible to do your game in the Windows Unity version and then open the project on the MacOS version ( use the same version number of Unity ) and build the project. If you did this on the VMWare way of things you would need to leave it for quite a while as all the shaders used need recompiling and God knows what else Unity gets up to. This is also all handled by Unity automatically so it's not a scary thing.

Compatibility wise you'll generally find that no changes are needed unless you use 3rd party plugins which are Windows only. Plus of course any Windows only API calls.

If you're planning on doing a lot of MacOS stuff then definitely buy a 2nd hand M1 based Mac mini as it'll save you a tonne of time. If you do plan on going down that route then avoid any Intel based Mac mini as the GPU's in them are pretty crappy for gaming.
Mac Studio M4 Max ( 14 core CPU - 32 core GPU ), 32GB LPDDR5, 512GB SSD.
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 64GB DDR5 RAM, 2T PCIe 4.0 SSD.
Microsoft Surface Pro 11 ( Snapdragon® X Elite ), 16GB RAM, 512GB SDD.
ASUS ROG Swift OLED PG27AQDM OLED 240Hz.

Until the next time.

Kryzon

#7
Quote from: Qube on March 17, 2022, 04:52:11
It doesn't work like that. Unity builds the app directly for MacOS and you can choose ARM, X64 or universal build which includes both. The MacOS version of Unity can also build for Windows and Linux.
This is just from my ignorance since I don't have much Unity experience, but what exactly does the "Generate XCode Project" option in the build settings does? The manual is really vague about it.

I remember reading something about it being a "standalone XCode project", so you can take those files to a repo and use Github Actions to build it (PS ooh, found this resource: https://github.com/game-ci/unity-actions)

As for your advice on the VMWare method, thanks a lot!

----
More from this Game-CI project: https://game.ci/docs/github/getting-started

Xaron

Regarding VMWare, I did this for years and published several apps for iOS using it. But a real Mac is more comfort of course.

Kryzon

Thanks Xaron for the encouragement.
But perhaps you're mistaken, it was a 'friend' of yours that did it? (not sure if using a VM is allowed by their terms) :))

Xaron

#10
Oh hell yes, it was a "friend" of course.  ;D I'd never ever would do that!

Joke aside, that friend is still doing that, starting 2012 now 10 years later. He says that Apple actually don't care at all. Why should they? It's not fun to work with the VM as it's kind of dead slow (he says), but then for just building apps and submitting them it's ok (he says). ;)

So noone really would do that in a serious business, which is probably why Apple doesn't care. Plus it's impossible to start 3d accelerated apps in the VM (e.g. a simple OpenGL app won't open!) as there are no 3d drivers. But that doesn't matter for XCode. And honestly at the point when you want to do some serious app development for Mac and/or iOS you want to buy a Mac anyway. For hobbiests that VMWare solution is viable, it's not even illiegal, it's just a grey zone so to say.

Qube

Quote from: Kryzon on March 19, 2022, 02:15:10
Quote from: Qube on March 17, 2022, 04:52:11
It doesn't work like that. Unity builds the app directly for MacOS and you can choose ARM, X64 or universal build which includes both. The MacOS version of Unity can also build for Windows and Linux.
This is just from my ignorance since I don't have much Unity experience, but what exactly does the "Generate XCode Project" option in the build settings does? The manual is really vague about it.
Yeah this is a bit of a weird one. I know originally the Xcode project was needed but Unity can handle creation of the app from the IDE and then you use Xcode to deal with the AppStore side. I *think* the Xcode project side is more needed for iOS. Overall though I can't see exactly why you'd need this either. So I've no f'kin idea :))
Mac Studio M4 Max ( 14 core CPU - 32 core GPU ), 32GB LPDDR5, 512GB SSD.
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 64GB DDR5 RAM, 2T PCIe 4.0 SSD.
Microsoft Surface Pro 11 ( Snapdragon® X Elite ), 16GB RAM, 512GB SDD.
ASUS ROG Swift OLED PG27AQDM OLED 240Hz.

Until the next time.

Xaron

XCode is needed to do the signing stuff which you need for every Mac and iOS app.

Jayenkai

If you've never dealt with Apple's Code Signing, Provisions and other such fluff, then quite frankly you should think yourself lucky and move on.

With a Mac and Xcode it's approximately 6.128% easier, but it's still a bloomin' awful experience doing the initial setup.
I can't imagine just how horrific it would be without having Xcode help guide you along the way, because when I did it back in 2009 (pre XCode being able to do most of the gruntwork for me) it was more than enough to cause significant damage to my own sanity!
The fact that I was hospitalised with a brain tumour less than 3 years later is probably not related.
"Load, Next List"

Xaron

It got much better the last years when they added that automatism for code signing. That auto resolve for the teams (so let XCode "repair" it) works pretty well lately. But I know what you mean. Stackoverflow has become my best friend.  :))