Perforce Public Knowledge Base - Using Perforce with Unity3D
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



Using Perforce with Unity3D

« Go Back



I want to use Perforce Helix with  Unity3d?

How do I get started?
What issues should I be aware of?

Two Perforce Integrations exist.

  1. Unity has a "built-in" Perforce integration, provided by Unity and supported by Unity.
  2. 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 Packagespage1image15296 

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
is good.

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.

text //....js
text //....cs
text //...shader
text //....meta
text+l //
text+l //....proc
text+l //....md5mesh
text+l //....md5anim
text+l //
binary //....dll
binary //....exe
binary //....response
binary //....lib
binary //....pdb
binary //....u
binary //....ini
binary //....stub
binary //....ip
binary+l //....prefab
binary+l //....mb
binary+l //....mat
binary+l //....psb
binary+l //....mp3
binary+l //....fbx
binary+l //....unity
binary+l //....asset
binary+l //....aas
binary+l //....tga
binary+l //....jpg
binary+l //....lwo
binary+l //....wav
binary+l //....ogg
binary+l //....demo
binary+l //....roq
binary+l //....doc
binary+l //....xls
binary+l //....celtx
binary+l //....pdf
binary+l //....odt
binary+l //....ods
binary+l //....ppt
binary+l //....skp
binary+lS //
binary+lS //....bnk
binary+lS //....light
binary+lS //....shadow
binary+lS //....ibl
binary+lS //....bik
binary+lS //....upk

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

Other Resources:

Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255