Backup your Unity projects

Backup Unity Thumbnail

Keep your project safe! A brief overview on how to backup Unity projects. The best ways to perform conventional backups and manage source control of Unity, including a tutorial on setting up your own self-hosted Gitea repo.

Conventional

Conventional backups are as easy as archiving the Assets and ProjectSettings folders. The rest of the project can be built from those two folders. Keep them on a seperate drive in case the one holding your project is corrupted, and/or on a cloud server.

Source Control

Source control (version control) is a way of tracking changes to files over time. There are multiple solutions for this but I primarily use Git. To get it set up with Unity you’ll need to download Git, GitLFS, and (optionally) a Git Client like SourceTree. After installing Git, you can initialize LFS by using the following command in a Git Bash terminal.

git lfs install

The way you set up a project will differ depending on your git client or if you’re doing it via the terminal so we won’t get into that. Once it’s set up in your project’s root folder, you’ll want to add some files before your first commit (otherwise it will be very large).

Download the .gitignore and .gitattributes templates for Unity and include them in the root of your project where the hidden .git folder is. These will ensure unnecessary folders (like the library and builds) are not included. It will also prepare LFS. This allows certain file types to not be tracked, storage space in the repo.

After commiting, we’ll want to set up our remote. The easiest way is to create and new project on github and link it to your repo, but we’ll be hosting our git server locally with the help of Gitea.

Download the appropriate version and move the exe where you’d like it to run. It will open a terminal and show you the port it is running on (3000 by default). You can access it on localhost:3000 or use ipconfig to find the ipv4 address and append the port to that to access it with other machines on your network. For example http://198.123.1.12:3000

Upon accessing the server for the first time, you’ll be met with an initial configuration screen. For the database type I used SQLite3 as it was quite easy to setup.

You likely don’t need to change any settings. After setup you’ll be given the option to create a user (who will be made an Admin).

From here you can create a repository. Be sure to not initialize it otherwise you will not be able to push an existing project to it.

You’ll be given the the repository address. Just add it to your ide and you should be good to go!

Happy hosting!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.