Search Unity

Unity and Open-Source

Last month at Unite, we announced our Open-Source initiative, where we will be opening the source to various components of Unity (along with other helpful tools and samples) in the future.  We announced the presence of the Unity Test Tools project at our new home on BitBucket and since then we’ve watched as our community has cloned, made forks, and submitted pull requests (you can see the development of the Test Tools happening in the repository itself and the project’s issue tracker being used as well).  Since then we’ve released our Xcode Manipulation API (allowing you to modify and adjust a generated Xcode project) and iOS Native Code samples (giving examples for things like how to integrate Unity with native UI and how to do native video rendering).  We’re also gearing up to ship you the source for our new UI shipping in 4.6 (which is currently in open beta) and we’re making plans to open the source to other components as well.

We also announced our Contributor’s Guide that is now part of our user manual.  Today, I’d like to go through those steps with you.

The Steps to Contributing

Our repositories are hosted on BitBucket under either Mercurial or Git.  If you’ve already contributed to a project on GitHub, the process is the same here.  If you’re coming from Perforce or SVN (or some other centralized version control system) and these concepts of ‘forks’ and ‘clones’ and ‘pushing’ and ‘pulling’ are all new to you, we encourage you to follow the steps in the contributor’s guide very closely (since they will guide you along with screenshots every step of the way) and also take advantage of the ‘Further Reading‘ section.

The first thing you need to do is get an account on BitBucket, which is where we are hosting our repositories.  This is a very straightforward process (f you’re completely new to BitBucket, but have a GitHub account, feel free to use that same account over at BitBucket, (EDIT: You need to create a BitBucket account first and connect your GitHub (or Google) account to it.  From then on, you will be able to login to BitBucket with your GitHub (or Google) account) and if you’re wondering why we are on BitBucket instead of GitHub, please see our FAQ.).

Next, you’ll want to make your way over to our home on BitBucket and find the repository you want to contribute to.  Once you’ve done that, you’ll want to fork the repository to your own space.  A fork of a a repository is simply a clone of a repository, that lives under your own space where you are free to push your own changes to.

Clone your fork and apply your changes.  Unless you love getting down and dirty on the command-line, we recommend SourceTree from Atlassian for interacting with both Mercurial and Git.  It will work for you whether you are on Mac or Windows, and whether you are using Mercurial or Git.

Finally, open a pull request from your fork and wait.  A Unity Developer will look at your pull request and process it, and if it’s approved, it will be merged into our repository.

In the end, the process looks like this:
DVCS Overview

What Happens to Pull Requests

When you submit a pull request, generally one of four things can happen:

  1. The pull request is accepted as-is and is merged in its entirety.
  2. The pull request is closed as rejected.
  3. The pull request is not closed as rejected, but the Unity Developer will require that you do some extra work before the change can be merged.
  4. The pull request is rejected, but the Unity Developer still applies some of the changes from the pull request.

Cases 1 and 2 are straightforward.  Case 3 usually means you need to do some cleanup or handle some extra cases.  Case 4 will usually happen if the Unity Developer doesn’t think all of the changes apply, but wants to take some of them, or if the history of the changes needs to be cleaned up before they can be applied.  In our Unity Test Tools project, we’ve already seen cases of 1, 2, and 4.

In all cases, you’ll be notified of activity on your pull request by mail, so be sure you are set up to receive email notifications from BitBucket.

There You Have It

So, in just a few relatively simple and straightforward steps, you can be helping to improve Unity and its ecosystem, both for yourself and the rest of the community!  As I’ve said before, we’re excited to see what you create.

16 Comments

Subscribe to comments

Comments are closed.

  1. Hey, is there a detail date that the UI source code will be open?

  2. Thought it woulnd’t to give it a shot. I was right.

  3. I think that is very good move. Many developer want be part of unity development. And that is right way to contribute.

  4. Nice. But for it to be successful, it has to be visible. Over on UE4, it’s highly visible that you can get source, and contribute. To this end, I would recommend that Unity create a visible Unity Source link on the main site *and* forums, so that it’s very quick for new and old users to see this.

    The blog post will vanish out of sight pretty quickly, and if the world is to contribute, it needs to find it :)

  5. Nice. i know this was mentioned in the past, but GitHub is where it’s at, and it’s UI is simply better than BitBucket..

    Common operations, such as searching for things in the repo based on keyword is so much easier (maybe not even possible in bitbucket?)

    With that said, it’s still a nice move.

  6. I’d certainly love to contribute to to the UI repo when it becomes available. Some changes I had in mind would be the ability to assign character arrays (with null terminator support) to the Text component.
    Strings are one of the biggest weak points of C# IMHO, being able to optionally use a character array instead would be super helpful in reducing garbage generated. For instance, for text that I need to “type out” like a typewriter, I could easily manipulate a character array by inserting a null terminator at incrementing points in the array without generating any garbage.

  7. @GARY, Not sure if I get your logic. I don’t remember seeing you saying thanks when they dropped the basic license fees for all platforms. And we can make money off them as well. I think if there’s anyone getting ripped off here it’s Unity Tech.

  8. @Gary those components are for us free users too so stop complaining. No one is forcing anyone to commit any work against their will and open source is never about such $$ thing. If you are so narrow minded just keep your changes locally and stay away.

  9. Since you’ll be getting developers to do free work for company, you should drop the price of Pro. Otherwise you are simply ripping people off and getting people to work for free while the company cashes in on their work.

  10. Great news! As a developer I absolutely love Github and have been using it since University, so it’s wonderful that Unity developers now will be able to contribute to open source and lear easier!

  11. @ROBERT WAHLER, This isn’t something we control, but we will try to get some answers. Please raise the issue with the BitBucket support team.

    EDIT: It seems that you need to create BitBucket account and then ‘connect’ your GitHub account to it under the ‘Connected accounts’ link in the left sidebar of the ‘Manage accounts’ page. Once you have done that, you can then log in to your BitBucket account with your GitHub account. I have raised an issue with Atlassian/BitBucket to get further clarification on the issue and will update our documentation if needed.

  12. hopefully IL2CPP will be added once its mature enough. Hopefully!

  13. Have you fixed the github login to bitbucket? I get a “Unfortunately you can no longer sign up using your GitHub account” after going all the way through the oauth signup. I reported this on Sept 4 in the Unity support forums.

  14. @PIP ROBBINS, Not just yet, but we’re working on both documentation for our coding standard and a set of automated tools you can run to check that you’re compliant. For now, just do your best to follow the coding style of the surrounding code.

  15. Is there a guide to unity’s coding standard to avoid pull requests being rejected?

  16. Really nice! I’m looking forward how this evolves! It’s the right step from my point of view!