Search Unity

This Friday we published the Unity engine and editor C# source code on GitHub, under a reference-only license.

Wait… what?

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.

What this is not

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.

What is it then?

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, enjoy using it as reference for your Unity learning needs.

56 コメント



  1. AlinaWithAFace

    4月 20, 2018 4:48 am

    Woah, thanks!

  2. Gavin Belson

    3月 31, 2018 8:37 pm

    I don’t wanna live in a world where someone else makes the world a better place, better than we do.

  3. To make it clear:
    1) We don’t want, Substance, Enlighten, etc in source forms. Leave them as binary.
    2) We want C++ backend sources to inspect and enhance them, would like to submit PRs.
    3) We want C++ sources, to debug vague Unity errors, and possibly fix those in sources (see 2). There is no such thing as professional gamedev on a black-box engine. This simply doesn’t exist.
    4) We want to be able to write on C++ freely and unencumbered. Without the need for GC, if we wish to.
    5) We would like to take full control of our tech, not just the things, that you open for us like scriptable render, etc.
    6) We don’t want to compromise Unity in any way as it is the engine of our choice and we love it. We just want to make it more development-, professional- and community-friendly.

    1. Considering current Unity development direction (ECS, SRP) I think that C++ side will be less significant than C#. All new systems are released as C# sources (UI, SRP). In the future, C++ backend will be reduced to ECS and job system. You should read “Entity Component System principles and vision” in ECS documentation. It contains Unity roadmap for future releases.

  4. Andrew Witte

    3月 28, 2018 6:38 pm

    You should set this up to handle pull requests. I would like to add some missing operators for your math libraries (particularly related to vectors).

  5. It’s a pretty pathetic excuse to try and pin it all on legal issues that you’re not open sourcing the code. If it was so difficult, why are there thousands of open source projects that do just fine? You’re smart people, surely you can find a way to make it happen.

    1. Aras Pranckevičius

      3月 28, 2018 4:46 pm

      > It’s a pretty pathetic excuse to try and pin it all on legal issues that you’re not open sourcing the code

      Wasn’t my intent. I was trying to explain why we can’t “just do that right now”, as in, *iff* we decided to make source more widely available, it would be quite some work on both legal & technical side.

      That said, for people who really badly need the source right now, source licensing *is* available, and it does not cost millions.

  6. I think it is meanless if you don’t open the source…and don’t let us try to modify or report any bug…..

  7. It’s really hard to find anything in the repo. Where is the reference for the UI Button script and the editor inspector for the button?

    1. That is under a separate repo and it is open source –

  8. Wouldn’t it be technically possible to make a PR if you would sign over copyright (and other rights) to Unity itself,
    or was this the “can of worms” mentioned.

    1. Søren Løvborg

      3月 27, 2018 2:09 pm

      It is legally complicated. We may eventually figure something out (there seems to be a lot of interest), but for now, we can’t take PRs.

  9. Ippokratis Bournellis

    3月 27, 2018 6:37 am

    Nice move.

  10. >We’d open source all of Unity today if we thought we could get away with it and still be in business tomorrow.
    Can you please give us some insight into why this is the case? If I’m not mistaken, it has been shown that being non-open-source isn’t a prerequisite to having success in the game engine business. After all, it isn’t the engine itself that is being opened up (the real stuff is happening in C++ isn’t it?), just the managed DLLs.

    1. Aras Pranckevičius

      3月 27, 2018 9:27 am

      Perhaps poorly worded. We can’t “just open source everything” *right now*, primarily due to various 3rd party middleware that we include (Enlighten, FMOD, Umbra, PhysX, Substance, …).

      With some (large) amount of both technical & legal work, that could be solved, if we decide to do that. The sentence perhaps should have said “we can’t Just(tm) open source everything today due to some technical & legal constraints” or similar.

      1. These are the words of hope, indeed. Unreal uses TONS of third-party add-ons, including PhysX, so this of course can be solved. Binary compiled runtimes for Substance and stuff ARE fine, not interested in that. All we really want in the end is to inspect/improve Unity’s internal mechanisms and be able to code in C++ natively, right out of the box, without all the plugin development hussle.

        1. Please note that compared to the other versions, all licensed middleware was removed from UE4 and it made nearly from scratch. It’s not compatible with the previous versions. Also users have to license everything themselves from the non free 3rd party stuff. In some cases users will also have to merge various features from external branches and they will never be in the main engine.

          It’s not something that Unity can do easily or at all in a a short time period as project compability is very important to existing users.

        2. Gavin Belson

          3月 31, 2018 8:34 pm

          I don’t wanna live in a world where someone else makes the world a better place, better than we do.

      2. >primarily due to various 3rd party middleware that we include
        You don’t need to open source the third party middleware in order to open source the code that uses it. This can be achieved through DLLs. Similarily, we could open source our game’s source code (behaviours, etc.) without needing to open source Unity or any of the other DLLs we use.

    2. Aras Pranckevičius

      3月 27, 2018 9:28 am

      As to why the C# code itself is not under some more permissive license – because the “reference only” is what we went with today. It may or might not happen under a different license in the future; we’ll see.

  11. yeh having this resource now official just makes sense…. will the Unity VS tools get an option open the github source?

    will the docs be updated to reference the matching version source file? :P
    speaking of the docs maybe this built in without chrome ext … .. because its what many including myself have asked for before.

  12. “We’d open source all of Unity today if we thought we could get away with it and still be in business tomorrow”

    The single biggest threat to your success right now is NOT releasing the sources. All the best companies are open-sourcing their engines (Epic, Amazon Lumberyard, Cryengine) and benefiting immensely from it. Unity is the only one still stuck with the archaic and almost evil mindset of not releasing sources.

    If selling Unity source code is your main income source, then just ask for 5% royalties instead. But by all means, release the full sources of the engine

    1. Yeah, I second this. Not releasing source code when ALL major competitors already did is really weird. All Unity competitors ride the wave of community led improvements to their engines. Every seasoned Unity developer knows engine’s hard edges and soft spots that could be easily improved/expanded. Why not use this FREE workforce? We too want Unity to be the best engine on the market, why not let us help you UT?

    2. No, 5% royalty is really a lot and many people stay in Unity because it’s cheaper
      I would rather see only the C# part being open source(it’s already half way there), and the C++ side should stay closed if that means charging 5% royalty.

    3. A quick google search can tell that none of the engines you just mentioned are open source (Epic, Amazon Lumberyard, Cryengine). All of them have their source code published to github for reference only, so literally what Unity just did.

      1. Not true. The Unreal Engine is open (just not “open source”). You can modify the engine as you see fit and use it, as long as it’s within the EULA. A few have already done that.

        1. Nick
          “Yep, just to clarify, it is not technically “open source” it’s just a very very easily available source code…” – Alexander Paschall – Former Epic Games Staff

          So no UE4 is not open source and you can not distribute the engine as you wish, just look at how modding work with UE4,
          also “You are permitted to post snippets of Engine Code, up to 30 lines of code in length…”

          “The source code is open, and you are permitted to modify or extend it for your own uses but not to redistribute it or derivatives of it. You are also prohibited from combining it with other code that is licensed in such a way that would require it to be licensed under any other terms (for example, GPL’d code).”

          For those reasons and many more UE4 and those other engines mentioned are not really considered open source.

        2. oh my bad I misread your comment you understand it’s not open source… sorry.

      2. You are correct none of these engines are open source, but they still allow you to do pull requests and fix the code.
        in Unity case, you can’t touch the code but just look at it, I think if they allowed us to work on the C# part of the engine that would be enough.

        and thank you for pointing that out, I for one have forgotten what open source actually means.

        1. Caswal Parker

          3月 29, 2018 12:24 am

          That part specifically pertains to modifying and distributing the editor. You are not allowed to distribute an editor (modified or not) outside of Epic’s channels.

          If you make modifications to the engine for your shipped game builds that is all fine.

          For our modding, we have a version of our project that is cut down and works with the stock editor. Our engine changes are only for runtime issues anyway.

  13. So a fix (pull request) has been made on github and it fixes a problem the engine has for years, but wont be accepted because lawyers…

    Unity Team I hope you realize how lame this is, and start to accept our fixes.

    1. Just want to update this and say that the Unity team is working on a fix for the bug posted on github

      I’m very happy that they decided to not look away and are actually fixing it, because this was a very old bug I was very skeptical of Unity response but I’m glad they are doing their best withing the current legal situation.

      Keep the good work!

  14. This is good – it will make it easier for us to make sure Scene Fusion stays up to date between Unity versions!

  15. This is AMAZING and extremely helpful for all game developers using the engine Thank you!!

    now allow us to fix bugs, that’s literally FREE work and Unity should make use of our ability to find and fix these things
    it would benefit Unity as an engine and company but also it would be a great deal for all developers having bug issues.

    You can still review the code changes and approve or refuse it, just allow us to make fixing bugs faster

    Please allow us to modify the code, you have already let us read it, it makes no sense that we can’t modify it and test ways to make it better.

  16. John Anderson

    3月 26, 2018 9:24 pm

    Color-theme = DARK; compiling……

    1. Made my day ^^

  17. “We’d open source all of Unity today if we thought we could get away with it and still be in business tomorrow”
    With Unreal engine conquering mobiles like storm, you’ll be out of business tomorrow, if you WON’T release the sources, like Epics did. I can’t believe, that in 2018 there is still a software business model, that sells a dark skin as part of its subscription. Continue this way, and you will bury us all.

    1. I’m agree with you, but it works not for every type of business. For example, a company has a new project every month with cost $25k – $30k each. It’s about $300k annual, so 5% royalty to Epic will be $15k per year. But this company can buy annual Unity license for $1500, and it’s will be 10 times cheaper. So there are some point of balance between project cost, project length and number of projects per year where choosing Unity will be much cheaper, than Unreal.

      1. It will cost for a company $1500 annually only if it’s a one person-company. I don’t think such a company can open a new project every month. Well, it could, but obviously they won’t be profitable.

    2. Also… “Unreal engine conquering mobiles like storm” ? Unity is the most used engine for mobile gaming behind the in-house engines. and they also talk about this in last GDC lol.

      1. Look in perspective. Several years ago UE4 can’t mobiles at all. Now they can and they started conquering them. Several years ago UE4 was like a nightmare and total no-no for indies. Look at twitter now: lots of indie creating beautiful things with ease. So it’s just a matter of time. Short time.

  18. Stevens Miller

    3月 26, 2018 8:55 pm

    Thank you for doing this. We are in a new era of software property protections. Judicious steps like this one are the right way to go forward, as we balance the benefits to the customer of publishing source against the commercial interests of owner. Overall, I am very pleased by Unity’s general “we’re all in this together” philosophy.

  19. Does/will it include Timeline? That’s the main thing I use decompiled reference for currently

    1. Aras Pranckevičius

      3月 26, 2018 9:40 pm

      Good question! Some of the C# code that happens to be packaged up as “internal extensions” apparently is not there right now, including Timeline. Will look into what can be done about it.

  20. This is one of the most exiting updates I’ve read in a while. (The other being UnityScript’s departure) It will be immensely useful for making custom editors and UI things since disassembling does not provide enough context, and a lot of the Unity Docs for editor things tend to be one line blurbs with no examples. Hopefully in the future Unity will begin accepting PR’s or at least community modification in some way so that many of the bugs/typos that go unfixed for months or years can finally be fixed!

  21. Great news.Just been browsing the source code and I’ve already picked up a few development tips. Thanks for making this available for reference purposes

  22. Thanks for this! I frequently reference the source, and this will save me the hassle of disassembling it and dealing with all of the associated peculiarities. Also, as mentioned, being able to see the diffs is awesome.

  23. Marc-André

    3月 26, 2018 3:37 pm

    “only permits you to read the code, not modify it.”

    That’s dumb. At least allow me to fix the bugs I encounter, even if I don’t publish them.

    1. Isaac Surfraz

      3月 26, 2018 4:34 pm

      you “technically” could, just not give fixes to anyone else or ever admit to having done it…

      Legally gray at best though!

  24. Oh yes, the famous Unity Bug tracker where even the simplest thing that require a “typo fix” go to die for 10 years. Yes, please report the bug to UBT and dont forget to buy Pro!

  25. BRB just making my unity clone illegally using c# code and absolutely no engine and certainly not 1000 staff… or maybe not. But thanks for being transparent with existing code so that it may serve as a useful reference for how to do things the Unity way. For example rolling own tools with your own source. Now you know how a certain thing is supposed to be done.

  26. Peter Petrov

    3月 26, 2018 12:45 pm

    Hello. Please note that in many jurisdictions, modifying something for private use cannot be disabled by licensing terms since it corresponds to tinkering and is then part of common sense or jurisdiction laws. In my jurisdiction for example, If I download, modify then recompile the project for private testing is perfectly legal, as long, as I don’t distribute the modified library.

    You manually wrote that:
    “We would like to hear about it if you find a bug in the C# reference source code” – This is nice but it also implies that we usually compiled the code, made it run, tinkered it a bit, and debugged it inside the Unity itself (debugged Unity itself). Or, the act of tinkering, again :) It would be your best if you see somebody of us post a patch via the Bug Reporter to actually investigate it since most of us who analyze the code will actually write a patch-as-bug-report to give hints to your developers. (there is one pull request already on GitHub with very important potential-fix now).

    1. Søren Løvborg

      3月 26, 2018 1:53 pm

      We’re aware that jurisdictions vary (hence section 7 of the license). The blog post is obviously not legal advise, but just meant to give a layman’s summary of the most important restrictions. To learn your exact legal situation, always refer to the full license text and/or consult a lawyer.

      “If you find a bug” was definitely not meant to imply that you should attempt to fix bugs yourself, but simply refers to cases where people are reading the code and notice something that appears to be a bug. If so, we’d of course like to hear about it (preferably via the Bug Reporter, not a GitHub PR). :-)

  27. This is great news! On another note, is it possible to enable viewing of entire articles for feed readers? That would be much appreciated.

  28. That’s great. The diff between each versions (comments included) is definitely a plus that disassembled code could not provide.
    While it doesn’t cover all changes (the rest of the engine being closed C++, it does give an opportunity to make sure plugings follow breaking changes between versions.
    Thanks for that!