.net, HoloLens, Unity, UWP

Coding for the HoloLens with Unity 5 – Part #4: Preparing the Unity project for source code management

This will be a super short post, but something that I thought deserved its own post.

One thing I’ve noticed with Unity projects is that, by default, some of the files are created as binary files – for example, files in the “ProjectSettings” folder. This isn’t great for me if I want to commit files to GitHub or Subversion. I prefer to check in text files, so if a file changes, at least I can understand what changed.

To ensure files are generated as text, open the Unity editor, and go to Edit -> Project Settings -> Editor, which will open an Inspector panel in the Unity editor (shown below).

screenshot.1468703470

I’ve highlighted the values I changed in red above:

  • I’ve changed the default version control mode from Hidden Meta Files to “Visible Meta Files” – this means each asset (even binary) has a text file containing meta data, which is available through the file system. More information is available at this link.
  • I’ve also changed the Asset Serialization Mode from “Mixed” to “Force Text”.

After restarting Unity, you should notice that project settings and assets (such as prefabs) are now text files. I think this is more suitable for management in a code versioning system.

The only folders that I commit in my project are the “Assets”, “Library” and “ProjectSettings” folders. I choose to add all other folders and files to the ignore list.