Unity offers an Asset Server add-on product for easy integrated versioning of your projects and you can also use Perforce and PlasticSCM as external tools (see Version Control Integration for further details). If you for some reason are not able use these systems, it is possible to store your project in any other version control system, such as Subversion or Bazaar. This requires some initial manual setup of your project.
Before checking your project in, you have to tell Unity to modify the project structure slightly to make it compatible with storing assets in an external version control system. This is done by selecting Edit->Project Settings->Editor in the application menu and enabling External Version Control support by selecting Visible Meta Files in the dropdown for Version Control. This will show a text file for every asset in the Assets
directory containing the necessary bookkeeping information required by Unity. The files will have a .meta
file extension with the first part being the full file name of the asset it is associated with. Moving and renaming assets within Unity should also update the relevant .meta
files. However, if you move or rename assets from an external tool, make sure to syncronize the relevant .meta
files as well.
При занесении проекта в систему управления версиями, вам следует добавить в систему папки Assets
и ProjectSettings
. Папку Library
добавлять не нужно - при использовании файлов .meta, это просто местный кэщ импортированных ассетов.
При создании новых ассетов, убедитесь, что сам ассет и соответствующий ему .meta
файл добавились в систему управления версиями.
First, let’s assume that we have a subversion repository at svn://my.svn.server.com/
and want to create a project at svn://my.svn.server.com/MyUnityProject
.
Then follow these steps to create the initial import in the system:
Создайте новый проект в Unity и назовите его InitialUnityProject
. Вы можете добавить сюда любые исходные ассеты или сделать это позже.
Включите Visible Meta files в меню Edit->Project Settings->Editor
Закройте Unity (чтобы убедиться, что все файлы точно сохранились).
Удалите каталог Library
внутри директории с вашим проектом.
Import the project directory into Subversion. If you are using the command line client, this is done like this from the directory where your initial project is located:
svn import -m"Initial project import" InitialUnityProject svn://my.svn.server.com/MyUnityProject
If successful, the project should now be imported into subversion and you can delete the InitialUnityProject
directory if you wish.
Check out the project back from subversion
svn co svn://my.svn.server.com/MyUnityProject
And check that the Assets
and ProjectSettings
directory are versioned.
Откройте проект в Unity, запустив его зажав Option или левый Alt. Открытие проекта пересоздаст папку Library
, указанную в шаге 4.
Optional: Set up an ignore filter for the unversioned Library
directory:
svn propedit svn:ignore MyUnityProject/
Subversion will open a text editor. Add the Library directory.
Finally commit the changes. The project should now be set up and ready:
svn ci -m"Finishing project import" MyUnityProject