2
\$\begingroup\$

From what I understand, if you want to export a Unity or GameMaker game from the editor, the game needs to be compiled to create an executable. I thought that to produce a Windows executable, you needed to be on Windows. How does Unity and GameMaker compile to Mac and Linux, if the engine is running on Windows? Likewise, How do they export to Android and iOS? Do they use the NDK for Android? What about WebGL?

How does the export actually work? Do they use a cross-platform framework written in some programming language, and when you do things with the editor it generates code using that programming language and framework, so that when you export, that code gets compiled? For WebGL, since the UnityScript code doesn't get compiled, can we see the .js files with the code?

\$\endgroup\$
3
\$\begingroup\$

But I thought to produce a Windows executable you needed to be on Windows.

Not true; cross-compilation is a thing. This is essentially a compiler that runs on architecture A but produces executables for architecture B, and it's basically the only way to compile for (for examples) consoles, which don't generally have compilers that run on the console itself.

Similarly, tools like Unity which support deployment to platforms like iOS that generally require specialized development environments will usually defer to the specialized development environments in question. For example, by creating Xcode project files representing the game (even if they're only temporary) and invoking the Xcode build tools to get the executable signed and bundled appropriately.

It's not magic, and they're generally not using any kind of clever totally-platform-agnostic language or tools. Just a bunch of specialized ones for the task or tasks at hand, wrapped up behind a homogenized interface so it looks like magic.

\$\endgroup\$
0
\$\begingroup\$

There's a thing called IL (Interpreted Language), which is what unity compiles into. From this, it can then be compiled into C++, which most platforms support. For WebGL, Emscripten is used. (Source).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.