This Friday we published the Unity engine and editor C# source code on GitHub, under a reference-only license.
It's always been possible to disassemble the Unity .NET assemblies, and our terms of service explicitly permits doing so, for the purpose of understanding or improving your projects made with Unity. But there are two obvious disadvantages to disassembling: 1) while not hard to do, it's still rather inconvenient, and 2) the disassembled output doesn't give you the original comments and variable names, frustrating attempts to understand the code.
To address the convenience issue, a number of community members went out of their way and provided GitHub repositories with the disassembled code. Truth be told, we had mixed feelings about this. On one hand, we were happy to see our users organize a useful service to the wider Unity community, but on the other, their actions were, strictly speaking, not legal (while our terms permit disassembly, they do not permit redistribution, because that's a legal can of worms).
There was only one good solution that'd address both issues: namely for us to publish the original source code ourselves.
In the interest of forestalling misunderstandings and clickbait, it's worth taking a moment to emphasize what we're not doing.
We are not releasing Unity as open source. Not even a little bit. (Sorry.) It's not that we don't like open source. We'd open source all of Unity today if we thought we could get away with it and still be in business tomorrow, and we do have a growing number of open source projects. But the main engine will remain proprietary for the foreseeable future, and the C# reference source code is released under a license which only permits you to read the code, not modify it. Please consult the full license text for details before you get carried away.
We also do not take pull requests against the C# reference source code. We have neither the legal nor organizational frameworks in place to handle such PRs, not to mention that the mere act of preparing a PR is actually against the reference license (which, again, doesn’t permit modifications to the code). We would like to hear about it if you find a bug in the C# reference source code, but please report it using the Unity Bug Reporter (describing the issue and possibly linking to the relevant lines or files in the reference source code), not by submitting a pull request on GitHub.
C# source of everything that goes into UnityEngine and UnityEditor managed assemblies, for every single version going back to Unity 2017.1. Going forward, the repository will be updated shortly after every new release.
By looking at each commit you can see what has changed between successive versions. For example, 2017.3.1 patch 2 changed these files:
That’s it! The reference source code repository is at https://github.com/Unity-Technologies/UnityCsReference, enjoy using it as reference for your Unity learning needs.