Two Perforce Integrations exist.
- Unity has a "built-in" Perforce integration, provided by Unity and supported by Unity.
- The P4Connect integration is provided by Perforce and published in the Unity Asset Store.
In mid 2016 the built-in integration became FREE. For this reason, the The Unity built-in Perforce integration
is recommended over the alternative P4Connect application. Do not mix the two integrations
, you can only use one or the other.
The Unity built-in Perforce integration
- Perforce/Helix support is built into Unity 3D.
- As you make changes to your game in Unity, the integration will check files out or add them for you, transparently while you work in the editor.
- Generally, you will want to use P4V to organize your submissions in conjunction with the changes generated by the integration.
- This integration is written by unity and is not officially supported by Perforce software.
- We are happy to provide general advice to our customers who decide to use it.
What do I need to work with Unity3d?
Documentation for the Integration
Setting up a Perforce Server
To use Perforce successfully you will need to create and maintain a Perforce server which will store your assets. This document assumes that you are hosting your own server. Note that if you are using a cable provider for you internet, you may need to request a static IP from your ISP to allow your server to be accessible by remote users.
I suggest reviewing the document “Planning Your Perforce Server Installation”
Note! If you will be using Unity on Windows, it is strongly suggested that you configure your server to be case-insensitive. This will happen by default if your server is on windows. Here are instructions for installing the Perforce Server on Windows.
If your server is on Linux, you can use the Perforce Installation Packages.
On Linux you can configure it to run in case-insensitive mode.
Here is the Perforce Downloads Page. Please download the “Helix Server which matches your operating system and architecture.
If you are unfamiliar with the Perforce server, please review the “Introduction to Perforce” guide and the “Getting Started with P4V” guides
I discovered this blog entry about getting a server running on EC2
although we don't offer Perforce in the Cloud in the same way, the configuration advice
If you have more then 5 users on your team, you will need to purchase a Perforce license to enable your server. Please contact Perforce Sales from the licensing page.
Setting up each Perforce client.
Each user will need to have Perforce client software installed in order to manage their Perforce resources and maintain a consistent asset state for development. Although Unity will create changes for you, You will often need to use a Perforce client when you decide to check-in changes or decide to Sync another developers resources.
Our recommended client is P4V, It can be downloaded from the Perforce Downloads Page. If you are unfamiliar with P4V, please review the Getting started with P4V guide.
Once you have the Perforce server and client available, Create a dedicated Perforce Administrator account with local Administrator rights, and log in as this account before setting up Users, Workspaces and Filetypes. P4Admin is a tool provided with P4V which can help you with the Administration chores.
Each user will need to create their own Client/Workspace on their own machines. They need to make sure that the Perforce client root contains the
Unity Game root directory (which contains the "ASSETS" subdirectory);
Ignoring Files (setting up p4ignore)
Some Unity files should not be stored in Perforce, NEVER store the Library directory in your project under Perforce.
Unity has a github page where the master .gitignore list is maintained.
A .p4ignore file should be very similar. please use a .p4ignore file to make sure other files remain uncontrolled.
You must set the P4IGNORE environment variable for .p4ignore files to be active.
Here is the P4IGNORE man page:
Configuring Filetypes (setting up the typemap)
Perforce Filetype Options
It is important to differentiate “binary” vs text file formats.
As an administrator, run “p4 typemap” and update the file with the following typemap.
Setting up each User and Workspace
Once a user has P4V installed, they will then need to create a “Workspace” which is a location on their local machine, which will contain their Unity
Make sure that this workspace contains the directory containing your unity game files.
Setting up Workspaces in P4V
Things to watch out for:
- Be familiar with the Perforce Version Control Window,
- Make sure that Unity is set for "Perforce" in Edit > Project Settings > Editor > Versions Control, Mode : Perforce
- Be aware that Meta files are very important and need to be managed in Perforce just like other assets.
- More information about how Unity handles assets and meta files is here: Unity Manual: Behind The Scenes