Skip to content

Commit c36d1cc

Browse files
committed
01-GitVersionControl
1 parent 99f3c24 commit c36d1cc

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

#01-GitVersionControl/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 01 - Git Version Control
2+
3+
<a href="https://en.wikipedia.org/wiki/Version_control">Version control</a> is something that I’m sure most are familiar with (if not check out <a href="https://try.github.io/levels/1/challenges/1">this tutorial</a> and <a href="https://www.codecademy.com/learn/learn-git">this course</a>), but something that you may not be familiar with is how to optimize a Unity Project for Git version control.
4+
5+
One issue is that within a Unity Project there are many folders and files that can remain local and don’t need to be tracked. The Library folder, for instance, when not present is always constructed on load, while OS (Mac/Windows etc.) specific files don’t need to be synced across computers.
6+
7+
Firstly, in <b>Project Settings/Editor</b> insure <i>Version Control Mode</i> is set to <i>Visible Meta Files</i>
8+
9+
![](https://68.media.tumblr.com/21295ab661c90b11abcd7c48f3884567/tumblr_inline_oqanwi34ve1raxrd9_540.png)
10+
11+
as this is required for version control. The benefit of this meta files is that unique settings for a file (such as import settings for a sprite etc.) are saved to an associated meta file, so syncing is easier and faster between projects.
12+
13+
Now we could commit only the relevant files (that is, the <i>Assets</i> and <i>ProjectSettings</i> folders)
14+
```
15+
git add Assets
16+
git add ProjectSettings
17+
```
18+
but one issue is the annoyance of untracked files messages for files which we have no interest in tracking.
19+
20+
![](https://68.media.tumblr.com/b33e64e8851f18a6ed5e607abbfae64c/tumblr_inline_oqaoqkTz9m1raxrd9_540.png)
21+
22+
Luckily by writing a custom <a href="https://git-scm.com/docs/gitignore"><b>.gitignore</b></a> file (saved to the root project folder), we can specific the files that git should ignore tracking.</p>
23+
24+
```
25+
# Unity generated folders
26+
Temp/
27+
Library/
28+
29+
# Custom Build Folder
30+
Build/
31+
32+
# MonoDevelop generated files
33+
obj/
34+
*.csproj
35+
*.unityproj
36+
*.sln
37+
*.userprefs
38+
39+
# OS generated files
40+
.DS_Store
41+
.DS_Store?
42+
._*
43+
.Spotlight-V100
44+
.Trashes
45+
ehthumbs.db
46+
Thumbs.db
47+
```
48+
49+
![](https://68.media.tumblr.com/7857c45296d64380857e315195790950/tumblr_inline_oqaolztA411raxrd9_540.png)
50+
51+
One last point is the <i>Editor</i> setting <b>Asset Serialization Mode</b> to being <i>Force Text</i> or <i>Mixed</i> (between Text and Binary). Most Unity Projects will have scenes, prefabs and thus a lot of binary files. Force Text works better for version control in viewing the changes between commits, but Mixed means that binary files are imported faster into the project.

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# OS generated files
2+
.DS_Store
3+
.DS_Store?
4+
._*
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
# 50-unity-tips
2-
This is a collection of 50 tips for Unity (focusing on Mobile) which I have learned over the last year.
1+
# 50 Unity Tips
2+
3+
This is a collection of tips for Unity (focusing on Mobile) which I have learned over the last year.
4+
5+
[@defuncapps](https://twitter.com/defuncapps)

0 commit comments

Comments
 (0)