1
\$\begingroup\$

I am trying to create an installer which will download the source of the latest release of a Unity project from a repository hosted on Github and then build it into an executable file. I have tried looking online for a solution, but, they all require the Unity Editor to be installed.

Is it possible to build a Unity project from the source code into a .exe file or a .dmg file without the Unity Editor?

EDIT: From @DMGregory's answer, it seems that using an external tool to build Unity Projects will violate Unity's Terms of Service. Therefore, I am updating the question.

Does Unity provide a lightweight (installer) tool that can allow clients to build and install Unity projects from source rather than requiring the client to install the entire Unity Editor?

\$\endgroup\$
3
  • \$\begingroup\$ Why not just build the project yourself when you update it, and have your installer grab the latest build from your server? This is likely to be less to download in total than the entire source, assets, and build pipeline, and give you more reliable results. \$\endgroup\$
    – DMGregory
    Commented Jun 6, 2020 at 12:41
  • \$\begingroup\$ From my point of view, I thought it would be easier to let an installer dynamically build from the project source to the target platform rather than me building the project from the editor to multiple platforms and uploading the built executable. But after seeing your answer, it would go against Unity's terms of service. \$\endgroup\$
    – SidS
    Commented Jun 6, 2020 at 12:53
  • \$\begingroup\$ You'll have to compile for each target platform to test your game anyway, so doing these builds doesn't add more work for the developer before releasing an update. \$\endgroup\$
    – DMGregory
    Commented Jun 6, 2020 at 13:12

2 Answers 2

0
\$\begingroup\$

Unity's approved method for compiling the source of a Unity project into an executable is to install the Unity Editor - compiling either locally, or using it to communicate with a build server / cloud. That's the only method they offer or authorize.

If anyone were to provide a tool separate from the Unity Editor that could build Unity projects without a licensed Unity Editor installation, it would violate the Unity terms of service:

2.6 General Restrictions.

Except as expressly specified in this Agreement, you may not: (a) copy (except in the course of loading or installing) or modify or create derivative works of the Unity Software; (b) distribute, transfer, sublicense, lease, lend, rent or otherwise provide access to the Unity Software to any third party; (c) directly or indirectly make the functionality of the Unity Software available to multiple users or third parties through any means, including but not limited to by uploading the Unity Software to a network or file-sharing service or through any hosting, application services provider, service bureau, software-as-a-service (SaaS) or any other technology or service; (d) use the Unity Software for competitive analysis or to develop a competing product or service; or (e) do anything that could cause or result in the Unity Software (including the runtime portion thereof) being subject to any open source license (or similar license) that requires as a condition of use, modification or distribution that the Unity Software (including the runtime portion thereof) or other software combined or distributed with the Unity Software be: (i) disclosed or distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge. You acknowledge and agree that portions of the Unity Software, including but not limited to the source code and the specific design and structure of individual modules or programs, are confidential and constitute or contain trade secrets of Unity and its licensors. Accordingly, you agree not to disassemble, decompile, modify or reverse engineer the Unity Software, in whole or in part, or permit or authorize a third party to do so, except to the extent such activities are expressly permitted by this Agreement or by law notwithstanding this prohibition. Notwithstanding the restriction prohibiting decompiling in the immediately preceding sentence, you may decompile the Unity Common Language Infrastructure (CLI) assemblies solely to inspect their functionality for purposes of understanding or improving performance of your Project Content or any editor extension to the Unity Software.

\$\endgroup\$
7
  • \$\begingroup\$ I guess they do it like that to force users to buy the appropriate license..? \$\endgroup\$
    – Vaillancourt
    Commented Jun 6, 2020 at 12:54
  • \$\begingroup\$ Or to keep someone from marketing/distributing the "Yoonity Engine" as their own product or service, that uses the Unity Editor as a back-end to do the work of actually compiling a game. \$\endgroup\$
    – DMGregory
    Commented Jun 6, 2020 at 12:55
  • \$\begingroup\$ I thought the "Built with Unity" advertisement on the splash screen of a built Unity project was enough! \$\endgroup\$
    – SidS
    Commented Jun 6, 2020 at 13:00
  • \$\begingroup\$ Someone could hack the splash screen out of the compilation pipeline, or patch it out in a post-process step, while still retaining substantial "functionality of the Unity Software". \$\endgroup\$
    – DMGregory
    Commented Jun 6, 2020 at 13:02
  • 1
    \$\begingroup\$ By definition, a modding tool can only give access to Unity runtime functionality, not the Unity editor software functionality. You can't use an in-game level editor to, say, compile a new set of cross-platform game executables. A good rule of thumb: if it's in the UnityEditor namespace, it's not runtime functionality and may fall under this clause. \$\endgroup\$
    – DMGregory
    Commented Aug 22, 2020 at 16:35
1
\$\begingroup\$

You could provide a pre-built .exe, whose job is to just load a .dll containing the main game code. Then the installer (presumably not written in Unity) could theoretically build the .dll from the source files, referencing the main Unity dll included in the project as necessary.

This could theoretically work for Windows, using the C# compiler included in the .NET Framework, and if it does, I assume it could also work for Mac, but I’m not sure.

\$\endgroup\$
2
  • \$\begingroup\$ On Mac/Linux, the user would need the Mono SDK installed, or you could include a standalone compiler like this one (though it's no longer maintained) or Roslyn. Including assets, shader code, or changes to project structure/settings would still be challenging though. \$\endgroup\$
    – DMGregory
    Commented Jun 6, 2020 at 17:02
  • \$\begingroup\$ I suppose the game would need to exclusively use runtime asset loading, using raw pngs, a custom model file format, etc. Possible, but as you said, rather challenging. And since Unity stopped supporting loading shaders from strings, I am guessing they would need to be built in. \$\endgroup\$
    – Ed Marty
    Commented Jun 6, 2020 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .