Helix Core — version control from Perforce — offers plugins and integrations for everyone on your team. Developers, designers, and third-party contributors can use the tools they love. And you can still maintain a single source of truth across teams.

 

TRY HELIX CORE FREE

 

Full Video Transcript

Hello, in this video we’ll learn about P4Connect, an open-source version-control integration which extends Unity3d for Perforce. The P4Connect tool is fully supported by Perforce. P4Connect enables basic Perforce version-control tracking of the game assets used by Unity. It works within the Unity3d Editor (v4.6.1 and higher) on both Windows and Mac OSX.

In this scenario, one user Harry, has a game set up and checked into Perforce, We will demonstrate how to set up Sally to share the same assets which Harry is currently using.

Notice that P4Connect is already enabled on Harry’s machine, you can see this by observing the “P4 Settings” window, the “Perforce Window” and the small decorator icons used for files in the workspace.

Notice how Harry already has “rabbit-scene.unity” checked out. You can see it in his Perforce window, and also see the check-out icon in the Project window. If I bring up P4V, then I can see exactly the same assets within P4V also checked-out using the same decorators. You’ll notice that one of these has a metafile attached to it.

Take a moment to look at the workspace for Harry within P4V. You can see that the root is in c:\demo\harry and that the view is a pretty simple view mapping the assets in Rabbit into Harry’s workspace. So I need to create a workspace very similar to this for Sally.

Let’s create a new workspace and we’re going to call this “sally_unity” and we’re going to put his into c:\demo\sally. And this mapping down here we’ll change to //depot/Rabbit/…. And I’ll also add a mapping here, and then hit “OK”. And that creates the workspace for Sally.

Once Sally is set up in Perforce, we are ready for the next step--installing P4Connect.

But before we install, we need to create a new Unity Project for Sally and configure a few settings.

So let’s open a new project in c:\demo\sally, and we’re going to call it “Rabbit”. Wait a moment for Unity to process a few things. And as you can see we have an empty blank Project, no sign of P4Connect here at all.

But first we need to go to Edit->Project Settings->Editor.

Make sure under “Version Control” mode, we select “Visible Meta Files” and also under “Asset Serialization” mode, we chose “Force Text”.

The “Version Control” mode “Visible Meta Files” tells Unity to provide metafiles which are checked in alongside the data that are in your assets. This allows Unity to keep track of files as they are modified or moved and provide a better experience for you.

The “Asset Serialization” mode “Force Text” allows better merging and diffing between assets as they’re changed.

Now we go to File>Build Settings and check that it’s not set for “Web Player” because if web player is enabled the Editor extensions will not run and therefore P4Connect will not run. What would you select? Probably “PC, Mac & Linux Standalone”.

To install P4Connect, open Window>Asset Store. And you may have to login and look for “P4Connect”. Click on “P4Connect” and then just click, “Import”. So it’s going to download from Unity, all of the assets and show you the package it’s going to install. All you need to click at this point is, “Import”. If you wait a moment, you’ll see that there is updating going on (I can close the Asset Store window at this point) and the P4Connect assets are now inside Unity.

Sometimes after downloading and importing P4Connect, you may see an initial error message, “Bad settings, Please Fix”. This message simply means there are settings which need to be configured.

Go to Edit>Perforce Settings.This is a nice resizable window and you can also dock this, if you wish, in one of your other panels. First you have to “Enable Perforce” and then go add the Settings. The Username in this case, is Sally. The Workspace name is “sally_unity”. Then we “Connect”.

If you click on the icon at the top left it will pull up documentation on P4Connect online. If you have any questions about P4Connect, please feel free to use the documentation provided with all of these wonderful screen shots I recently updated.

In the Perforce Settings, you saw a set the “Connection Settings” and if you didn’t know what your settings are going to be, you have the possibility to actually load settings from these areas. You can get the defaults, you can get the environment variables, or you can look for P4config files. You can get from the Unity Editor Preferences or from the config asset.

There are also “Options”, which allow you set the details of how you want to interact with P4Connect, and “Diagnostics & Utilities” which report additional information and/or logging, if necessary. All these things can be modified as you need.

If you don’t want P4Connect on while you’re making a lot of changes, it’s possible to disable it by hitting this big button. Now the configuration will be the same and will remain correct. And if you re-enable it, it should just be connected right away. However if you disable it, and then Save the settings, this allows you to keep P4Connect installed, but have it so that it does not interfere with any big asset moving or renaming operations you may be in the middle of. You’ll want to turn it on later and do some fixes manually if necessary. Click the “Save Settings” button to save the settings from all the panels of the “p4 Settings” dialog and preserve them for the next restart of Unity.

I suggest using the default editor save preferences. There is an option to save settings in a Configuration Asset, and you might want to consider using a configuration asset if you are running more than one project in a workspace, are running into flakey configuration issues, or if you wish to save your configuration to file in Perforce so other users can use it as a prototype.

Next, Sally needs to update her workspace with assets from the server. Starting in the “Project” window, click on the Assets directory and then right-click, go to “Perforce>Get Latest Revision”. Then say, “Yes”. You can see it’s finding all of the files that belong here. We wait a little bit and it should be synchronized.

Thank you for watching.

Course - Versioning for Designers and Game Developers