Github For Unity



  1. Github For Unity Asset Store
  2. Nugetforunity
  3. Github For Unity Plugin

The new GitHub for Unity extension brings the GitHub workflow and more to Unity, providing support for large files with Git LFS and file locking. At the time of writing the project is in alpha, but is still usable for personal projects. OpenIAB plugin enables Unity developers to reduce integration and maintenance time. The plugin uses one common interface for 3 mobile platforms: Android, iOS and Windows Phone 8. It’s based on OpenIAB library developed by One Platform Foundation team.

  • GitHub authentication is embedded in Unity, including 2FA. And with a click of a button, you can quickly initialize your game’s repository. Use the GitHub for Unity Extension Get off of the command line and work exclusively within Unity by downloading and installing the GitHub package!
  • Let’s set up GitHub to work with Unity! Github's Website: Download Github Desktop: Unity.gitignore: http.
  • View the Project on GitHub michidk/Unity-Script-Collection Unity Script Collection A maintained collection of useful & free unity scripts / libraries / plugins and extensions.

Unity is awesome. Git isawesome. Wouldn’t it be nice if they got along?

By default, the Unity editor does not work well with Git. To name a fewproblems:

  • Noise: The editor manages hundreds of temporary files. Merely opening orclosing the editor will create, delete, or modify some of these files.Additionally, since it’s possible to develop on and build for multipleplatforms, there are many more extraneous files than you might expect to findon, say, a Rails project.
  • Broken object references: The editor keeps track of objects with randomlygenerated GUIDs. If these GUIDs are not committed to Git properly (i.e., via.meta files), the project may break when you, for example, switch branches.The more you rely on the editor, the more common and potentially catastrophicthese errors are.
  • Unresolvable merge conflicts: Depending on your settings, the editor willsave some or all of your files in binary format. If you and a team memberhappen to edit the same file independently – a common scenario if you use theUnity editor heavily – you will not be able to resolve the merge conflictwith Git, and will have to use special tools.
  • Large files: A typical Unity project requires a number of large binaryassets for 3D models, sounds, images, fonts, etc., which can significantlyslow down your Git workflow and waste storage space.

The solution is straightforward:

  1. Add Unity-specific .gitignore settings
  2. Configure Unity for version control
  3. Use Git Large File Storage
Github

1. Add Unity-specific .gitignore Settings

Github For Unity

We recommend GitHub’s Unity .gitignore template.

In addition, depending on the platforms you intend to use for development, youshould gitignore common files for macOS and/orWindows.

2. Configure Unity For Version Control

Github For Unity Asset Store

With your project open in the Unity editor:

  • Open the editor settings window.
    • Edit > Project Settings > Editor
  • Make .meta files visible to avoid broken object references.
    • Version Control / Mode: “Visible Meta Files”
  • Use plain text serialization to avoid unresolvable merge conflicts.
    • Asset Serialization / Mode: “Force Text”
  • Save your changes.
    • File > Save Project

This will affect the following lines in your editor settings file:

Github for unity clone
  • ProjectSettings/EditorSettings.asset
    • m_ExternalVersionControlSupport: Visible Meta Files
    • m_SerializationMode: 2
  • If you’re curious, you can read more about Unity’s YAML scene formathere.

3. Use Git Large File Storage

Nugetforunity

Git Large File Storage (LFS) uses Gitattributes totrack large files with Git, while keeping them out of your actual repository.Note that this will only work if you use GitHub or aserver that supports the Git LFSAPI.

To set it up, download and install the Git LFS command line extension asdocumented on the Git LFS site.

You can manually track the file types that you’d like Git LFS to manage, asdescribed in the Git LFS docs. However, given the numerous file types that Unitysupports, you are likely to miss a few.

Instead, feel free to use this sample .gitattributes file, whichcomprehensively accounts for all the file types that Unity currently supports(either natively or via conversion):

A Bonus For GitHub Users: Automatically Collapse Generated File Diffs

If you use GitHub to review diffs (ex., as part of a pull requestworkflow), you’ll noticethat changes in Unity-generated YAML files are usually not actionable. You canreduce the clutter they introduce, while preserving the ability to review themas needed, by automatically collapsing thediffs on GitHub.

To do so, just append this to your .gitattributes file:

You can read more about this featurehere.

You should now be able to use Git to version control a Unity project as younormally would:

  • Any changes detected by Git will be legitimate, not noise generated by theeditor.
  • You will be able to commit your changes to your repo confidently, withoutfearing that the project will suddenly break when a team member tries to fetchit or you switch branches.
  • Your large binary files can be tracked without slowing down or cluttering yourrepository.
  • Changes to files generated by Unity (such as Scene files) will have diffs thatcan be inspected normally, and merge conflicts can (at least in theory) beresolved manually. Although…

Actually, About Those Merge Conflicts…

Manually resolving merge conflicts between Unity-generated YAML files is verydifficult and error-prone. If you followed the steps above and you’re usingUnity 5 or later, you can use the editor’s SmartMerge (a.k.a, “Unity YAMLMerge”). There are also various merge tools on the Unity AssetStore.

Backblaze cloud storage. As a developer, though, I find these solutions somewhat unsatisfying. Theunderlying problem is not that there is a merge conflict, per se, but that atool (the Unity editor) is translating our commands and our knowledge into alanguage (the Unity YAML format) that is difficult to understand, and indeedthat was not really meant to be manipulated directly.

Fortunately, a code-centric approach to Unity development (ex., viaZenject) can minimize these kinds ofproblems, while also supporting numerous software development best practicesthat are often lacking in Unity development.

Version Control is an important thing when you’re working on projects with several different people involved. One could argue that it’s important even if you’re working by yourself since you can maintain consistent backups of your projects. Throughout the years, Unity3D has had several different “built-in” version control solutions. One of the best ones, in my opinion, was the Unity Asset Server. Unfortunately, the Asset Server is now a legacy product and it sounds like Unity will no longer be updating it for future releases. The other downside to the Asset Server is that it requires a Pro license for Unity in order to implement it. Aside from the Asset Server, there are several different third-party solutions such as PlasticSCM, Perforce, and UVC. I’ve experimented with all of these different solutions and the best one that I came across was none other than simply using GitHub. In this post, I will detail the steps that need to be taken in order to get your Unity project’s version control working with GitHub.

Setting up GitHub and Unity

The first thing that you will need to do is create a GitHub account.

  • Go here
  • Fill out all the information on the page and “Create Account”
  • Choose a plan that you want to use. You can use the free or paid account to accomplish version control with Unity. The main benefit of a paid account is the ability to set your repository to private. If you use a free account, your repo will be public and other people can see it.
  • Once the account is made, go to your dashboard
    On your dashboard, click the “+ New Repository” option:
  • On the New Repository window, select the owner of the repo (this will probably just be you)
  • Put in a repository name. E.G: MyUnityGame.
  • Put in a Description if you want.
  • Set it to public or private (If you’re on a free account you can only choose public).
  • Check the box that says “Initialize this repository with a README”
  • Click the “Add .gitignore” box. On the filter box that comes up, type “Unity”. You will see a Unity option come up in the list, choose this option.
  • You can leave the “Add a license” box alone unless you know what kind of license you want to use. I usually leave mine blank.
  • Click “Create Repository”
For

Now that the repository is created, you need to get the repository onto your computer. To do this, download and install GitHub Desktop. There are Mac and PC versions of the program.

Once GitHub Desktop is installed, open it up and sign in to your GitHub account when it asks you for your credentials. If you ever need to login to your account again for any reason (such as a password change), click the Gear Icon in the top right of the program and choose “Options”, as seen here:

Then choose the “Add Account” button:

On the main GitHub Desktop Window, click the “+” Icon at the top left of the program. Choose the “Clone” option on the window that comes up. Here, you will see a list of repositories that you have available to you. Left-click on the one you want and choose “Clone repository” where repository is the name of the repository you are looking to clone. When you click this, GitHub will ask you where to save the clone. Choose a location on your hard drive that works best for you and it will begin copying the repository to your local machine.

Once the transfer is done, you should be able to see your repository on your local machine, in the folder that you told it to clone to. E.G: C:UsersDocumentsMyUnityRepo

At this point, you can either create a new Unity project inside of this folder or you can transfer an existing project into this folder as seen here:

Before you start to commit or pull changes from GitHub, you need to make sure your Unity is setup properly. Open up the Unity Project that you want to setup for use with GitHub and go to Edit à Project Settings → Editor

Github For Unity Plugin

On the right side of Unity, where the Inspector usually is, you will see a bunch of settings listed. From the “Version Control” drop down box, choose “Visible Meta Files”. From the “Asset Serialization” drop down, choose “Force Text”. See the following screenshot:

It is important that this is done. Torrent sony vegas for mac. If you do not do this, your GitHub commits and pulls will NOT work.

Once this step is done, you can begin to commit and pull changes to your GitHub repository and everything should work.

PLEASE NOTE:

The .gitignore file that comes with the Unity GitHub .gitignore preset passes over just about every file and folder EXCEPT for the Assets and ProjectSettings folders from your Unity Project. This means that whenever a change is pulled from the repository, Unity will have to build a library file for it on your machine. Depending on the volume of changes, this may take a while or it may take a few seconds. This also means that if you make changes to your Unity interface on YOUR computer, those changes will NOT be committed to the repository and to everyone else’s computer. Basically, your Unity UI is unique to your computer so you can setup your UI however you want and the other people on your project will not have their own Unity UI changed.

That’s about all there is to setting up Unity with Github as a Version Control solution. If you’re not familiar with GitHub or how Git works, you will want to research that information since this post does not cover the ins and outs of Git.

Thank you!

Blogger: Mark Philipp, Application Engineer at Studica





Comments are closed.