Perforce typemap for Unreal Engine: a recommended setup
For Unreal teams on Perforce who want every new .uasset to lock on checkout and every build output to stay writable. You get a typemap you can copy, a plain explanation of each modifier, what to do with files that are already in the depot, and how to review and change the server typemap from Gameheim's P4 Administration.
Why an Unreal Engine project needs a Perforce typemap
Perforce holds every asset and every revision of large Unreal productions, and it decides how to store and open each file from its file type. When a file is added, the server picks that type. Without a typemap it guesses from the content: text or binary, nothing more. For Unreal that guess is not enough, because most of a project is binary content that cannot be merged.
Two artists who open the same .uasset at the same time will both be able to submit, and one of them will lose their work: there is no way to merge two versions of a Blueprint or a map. The fix is the +l modifier (exclusive open). A file typed binary+l can be opened for edit by one person at a time, so the second person is stopped before they start, not after they finish.
The opposite problem shows up with compiled code. Perforce syncs files read-only until you check them out. If the team shares compiled editor binaries or plugin DLLs, a teammate who rebuilds the project can hit linker errors such as LNK1104 because the file on disk is read-only. The +w modifier keeps those files writable on every workspace.
The place to set these rules once, for everybody, is the server typemap: a table of file types and depot path patterns that Perforce applies to every new file. The catch is that it only applies to new files, which is why it pays to set it up on day one.
How Gameheim manages the Perforce typemap
Gameheim gives the project a Typemap page inside P4 Administration. It reads the live typemap of the project's Perforce server through the Gameheim agent, shows it as an editable table (Filetype and Depot path, one row per entry), and writes it back when you save. You do not need to edit a spec form in a terminal.
- Insert Unreal Engine recommended entries adds a curated Unreal preset to the rows you already have. It merges: rows that are already present are not duplicated, and nothing you wrote is removed.
- Every row is checked as you type. A filetype must be a Perforce base type with optional modifiers (for example
binary+l), and a path must start with//. Invalid rows are highlighted and Save stays disabled until they are fixed. - Rows can be reordered with the up and down arrows. Order matters in a typemap: when two lines match the same file, the later line wins.
- Saving asks for a reason and a confirmation that the change affects every future
p4 addon the server. When your organization has dual approval turned on, the save waits for a second SUPER user to approve it before it is applied. - History lists previous revisions of the typemap when the server keeps them.
The typemap belongs to the whole Perforce server, not to one project, so the page is available only to users whose Perforce access on that server is super. The rest of the team still benefits: when someone checks out files with the +l type from the P4 Workspace page, Gameheim tells them that opening those files blocks everyone else until they submit or revert. See Perforce file locking for Unreal assets for the day-to-day side of locking.
| Step | By hand | In Gameheim |
|---|---|---|
| Read the current table | p4 typemap -o | Loaded live from the server through the agent, as an editable table |
| Add the Unreal rules | Type or paste each line into the spec form | Insert Unreal Engine recommended entries, merged without duplicates |
| Catch a typo | The server rejects the form when you save it | Invalid rows are highlighted as you type and Save stays disabled |
| Change the order | Cut and paste lines in the editor | Up and down arrows on each row |
| Record the change | Up to whoever made it | A required reason, and an entry in the P4 Administration Audit log |
| A second pair of eyes | A team habit | Optional dual approval by a second super user |
| Files already in the depot | p4 edit -t or p4 retype | The same: Gameheim does not retype existing files |
How to set up the Unreal typemap in Gameheim
- A Perforce project in Gameheim with a connected Gameheim agent. See Install the Gameheim agent.
- Perforce
superaccess on the project's server, and access to Project Administration for this project (leads and admins of the organization have it; others can be enabled from the Team page). - If your organization requires dual approval, a second user with
superaccess who is a member of the project.
Open P4 Administration
Go to P4 Workspace and click P4 Administration in the links above the workspace. The link only appears once Gameheim has confirmed your Perforce access level. The page header shows the server and Your access:.
Open the Typemap card
Click Typemap. The page Server typemap loads the current table from the server. If the table is empty, the page says so and suggests inserting the Unreal Engine preset.
Insert the Unreal Engine preset
Click Insert Unreal Engine recommended entries. The preset rows are added after your existing ones. Review them: if your studio uses extra extensions (source art such as
.fbxor.psd, audio, video), add rows for them with Add row.Tip:If a later row of yours matches the same files as a preset row, yours wins because it comes later. Use the arrows to put broad patterns first and specific ones after.Save with a reason
Click Save. In Save typemap, write the Reason (required) (the approver reads it), tick I understand this change affects every future p4 add server-wide, and click Submit for approval. The save replaces the whole server typemap with the rows on screen.
If dual approval is on, an Approval requested dialog confirms that the change is waiting and shows when the request expires. The approver finds it on the Dual approval page under Inbox. You can follow your own requests under My requests.
Retype the files that were already in the depot
The new typemap applies only to files added from now on. For existing assets, change their type with Perforce itself (see the next section). Gameheim does not retype existing files.
The recommended Unreal Engine typemap
This is the preset that Insert Unreal Engine recommended entries adds, written as it appears in a p4 typemap spec. //....uasset means every file ending in .uasset anywhere on the server.
TypeMap:
binary+l //....uasset
binary+l //....umap
binary+l //....upack
binary+l //....ubulk
binary+l //....ufeature
binary+l //....udic
binary+l //....ubinary
binary+Sw //....ushaderbytecode
binary+Sw //....ushadercache
binary+S //....psym
binary+w //....dll
binary+w //....exe
binary+w //....pdb
binary+w //....lib
binary+w //....so
binary+w //....dylib
text //....ini
text //....uproject
text //....uplugin
text //....txt
text //....csv
text //....json
text //....xml
text //....bat
text //....py
text //....shEpic publishes its own example in Using Perforce as Source Control. The reasoning is the same: lock what cannot be merged, keep text as text, keep build outputs writable.
How to edit the Perforce typemap from the command line
Without a web tool, the typemap is a spec form you edit as text. The procedure is the same on every server, and it needs a Perforce account with administrative rights.
- Save the current table first:
p4 typemap -o > typemap-backup.txt. Saving the form replaces the whole table, so this file is your way back. - Write the form to a file with
p4 typemap -o > typemap.txt, or runp4 typemapto open it in the editor set byP4EDITOR. - Under
TypeMap:, write one rule per line, indented: the file type, a space, the depot path. Quote a path that contains spaces. Put broad patterns first and specific ones after, because a later line wins when two lines match the same file. - Load the file with
p4 typemap -i < typemap.txt, or save and close the editor. If a line is malformed the server rejects the form and nothing changes. - Test with a throwaway file:
p4 addit, then runp4 openedon it. The type in parentheses, for example(binary+l), is the one the typemap assigned. Remove the test withp4 revert.
p4 typemap -o > typemap-backup.txt
p4 typemap -o > typemap.txt
# edit typemap.txt, then:
p4 typemap -i < typemap.txt
# check what a new file would get
p4 add Content/Test/T_Check.uasset
p4 opened Content/Test/T_Check.uasset
p4 revert Content/Test/T_Check.uassetPerforce file type modifiers explained
| Modifier | What it does | Use it for |
|---|---|---|
+l | Exclusive open: only one user can have the file open for edit at a time. | Unmergeable assets: .uasset, .umap. |
+w | The file is always writable on the client, even when not checked out. | Build outputs that get rebuilt locally: .dll, .exe, .pdb. |
+S | Only the head revision is stored; older revisions are purged. | Large derived files whose history has no value. |
+S<n> | Only the most recent n revisions are stored. | Large files where a short history is enough. |
+x | The execute bit is set on the client. | Shell scripts on Linux and macOS. |
+k | RCS keyword expansion ($Id$, $Date$ and similar). | Rarely useful in game projects. |
+m | Preserve the original modification time. | Tools that depend on file timestamps. |
+C | Store a full compressed copy of each revision (the default for binary). | Binary files, already the default. |
+F | Store a full, uncompressed copy of each revision. | Files that are already compressed. |
Modifiers combine: binary+Sw stores only the head revision and keeps the file writable. The full list is in the Perforce reference: file type modifiers.
Why the typemap is not retroactive, and how to retype existing files
Perforce records a file type on each revision. The p4 typemap reference is explicit: the table only affects files added after it is created. A .uasset added last year as plain binary stays binary, without +l, after you save the new typemap. This is the most common reason teams think their typemap "does not work".
- Find out who has the files open:
p4 opened -a //depot/Game/Content/....uasset. Retype only what nobody is working on, and tell the team first. - To change the type from the next revision on, open the files with the new type and submit them, for example
p4 edit -t binary+l //depot/Game/Content/....uasset, then submit the changelist. Files you already have open can be switched withp4 reopen -t binary+l. On a large content folder this creates a new revision of every file, so submit it one folder at a time. - To change the type of revisions already stored, without new revisions, a Perforce administrator can use
p4 retype -t binary+lon the path. It changes stored revisions in place, so try it on a small path first. - Check the result with
p4 fstat -T headTypeon a few files, or look at the file type in P4V.
p4 opened -a //depot/Game/Content/....uasset
p4 edit -t binary+l //depot/Game/Content/Characters/....uasset
p4 submit -d "Retype character assets to binary+l"
p4 fstat -T headType //depot/Game/Content/Characters/....uassetTroubleshooting the typemap page
- The Typemap card is missing. It is shown only when your effective Perforce access on the server is
super. Your access is the lower of what the Perforce server grants you and the ceiling set for you in Gameheim. - A row is red. The filetype must start with one of
text,binary,symlink,apple,resource,unicode,utf8,utf16, followed by optional modifiers; the path must start with//and contain no spaces. A path segment that is exactly..is refused; the...wildcard is fine. - The save did not apply. If dual approval is on, the change waits for a second SUPER. Check My requests on the Dual approval page; an expired request can be resubmitted.
- Plugin DLLs are still read-only after the save. The typemap only covers new adds. Retype the DLLs already in the depot as described above.
- The history is empty. The dialog explains which server setting has to be on for typemap revisions to be recorded.
The P4 Workspace page can also point you here. When the Plugin Changes panel shows Typemap not configured, the server has no binary+w rows for compiled plugin modules; a SUPER user can click it to stage exactly those rows. See Unreal Engine plugins with Perforce.
Frequently asked questions
What is the best Perforce typemap for Unreal Engine?
Use binary+l for unmergeable content such as .uasset and .umap, binary+w for build outputs such as .dll, .exe and .pdb, binary+S or binary+Sw for large derived caches, and text for .ini, .uproject, .uplugin and scripts. Put broad rules first, because later lines win when two lines match the same file.
Does changing the Perforce typemap update existing files?
No. The typemap only applies to files added after the change. Files already in the depot keep the type stored on their revisions. To change them, open them with a new type using p4 edit -t and submit, or have an administrator run p4 retype on the stored revisions. Check the result with p4 fstat.
What does binary+l mean in Perforce?
It is the binary file type with the +l modifier, which means exclusive open. Only one user can have the file open for edit at a time; anyone else who tries is refused until the first user submits or reverts. For Unreal assets that cannot be merged, this prevents two people from doing work that one of them would have to throw away.
Why do teammates get LNK1104 errors on plugin DLLs?
Perforce syncs files read-only unless they are checked out. When compiled plugin or editor binaries are in the depot, a rebuild on another machine can fail because it cannot overwrite a read-only DLL. Typing those files binary+w keeps them writable. Remember to retype the DLLs already in the depot, because the typemap does not change existing files.
Who can change the typemap in Gameheim?
Only users whose effective Perforce access on the server is super, because the typemap is server-wide. The page is under P4 Administration. When the organization has dual approval turned on, every typemap save must be approved by a second user with super access who is a member of the project.
