Looking for C++ Unreal Perforce Advice

Hello Community,

I’ve had a go setting up a local Perforce server for my Unreal project. Besides a sparse few .P4Ignore lists in a PasteBin here and there, I haven’t found much information on how to ignore certain files and folders when collaborating in Perforce.

Does anyone know if it’s worthwhile to have each user register a .P4Ignore environment variable? Are the extra files so big that it’s worth it to ignore them?

I’ve seen it suggested that while you should choose your project’s root folder when you create your workspace, you shouldn’t add all of its subfolders to the depot. I’m not sure how to avoid this as it seems all of the files in the workspace are detected and uploaded. As well, Unreal’s Perforce interface lacks any mention of ignoring files, leading me to believe that it’s not expected.

Any advice from those who have collaborated on a C++ Unreal project would be appreciated.


You shouldn’t need P4Ignore for anything. Just follow the steps here: and only copy up the folders they tell you. Then all should be good.

Hi @ExtraLifeMatt ,

Thanks for your advice.

When I created the depot, I think it asked me to select folders, and so I couldn’t select files like the .UProject so I selected the entire project folder to upload. I’ll try it over again tonight and see if there’s a way to select individual files.

Even if I am able to select files however, when a user pulls the depot down to their workspace and opens the .UProject, won’t it generate the other folders (Intermediate, etc.) within their workspace and thus push them back up to the depot?

Nope. If the folders aren’t in the depot, Perforce will ignore them unless you purposely do a p4 add for them.

As for the initial population, you can just manually drag and drop the folders/files onto p4v or whatever and skip the wizard asking you to upload just a folder.

Wow, that sounds like the ticket. I’ll give it a shot tonight.

Thanks for the clarification.

I followed your advice, and the server worked well.

Thanks again!

I don’t see how this is meant to work. If I don’t have the p4ignore set on every user, p4v wants to add all the garbage in Intermediate to the changelist when doing a reconcile, which is necessary for it to pick up changes in cpp files.

Hi @Zeblote ,

I didn’t mark Intermediate/ for add and never submitted it to my depot. .CPP files are usually stored inside of Source/ which should be included as per the Unreal Perforce documentation. As long as your team members each have Xcode or Visual Studio, they should be able to right-click the .uproject and generate the extra files they need.

I didn’t add those to the depot either, yet it still picks them up during reconcile. So I’m confused why it’s working for you.

Did you submit the project folder? That would explain why it’s including them. You should only add the folders highlighted in green in the Unreal Perforce documentation. If you already did that then I’m afraid I don’t know why it’s still including folders that you haven’t manually added yourself. They’ll obviously be needed in your workspace and be generated there but the depot shouldn’t even be aware of folders/files of which you haven’t manually included or manually included the parent folder of.

If you do a reconcile on the project folder it will pick up anything except the ignored files. If you don’t ignore anything you should reconcile the sub-folders individually like the source folder to avoid the extra files trying to be added.

What @GarnerP57 said. Reconcile tells P4 to add / remove / edit any files in the folder you reconcile if they don’t match (or don’t exist) in the P4 depot. Reconcile should only be used in the case that you have some set of changes, but aren’t sure what they are - and even then, only on suspected folders. Avoid doing it on the entire root directory as you’ll pick up the things you shouldn’t be submitting (Intermediate, Binaries, etc).

Using a .p4ignore is a good idea - stops anyone accidentally adding stuff they’re not supposed too.
Else, yeah… could end up with all sorts of stuff in your p4 depot you didn’t mean to add.

Just a heads-up that Perforce has just updated their documentation and consolidated it into a new “knowledgebase”. You can see what I think are new articles on .p4ignore HERE.

Anyways, we ended up using this p4ignore (some project specific things removed):

# Ignore VS stuff

# Ignore generated folders

# Ignore the same things for plugins

# Don't ignore icon files in Build

# Ignore lightmaps

Also, a trick that somehow is not mentioned in the docs, is that you should set P4IGNORE to a file name and not a file path. For example

p4 set P4IGNORE=.p4ignore

will make it automatically use .p4ignore files in folders. So you can just put that in a batch file and new developers click it once and it works.

Thanks, @Zeblote ,

Does anyone have a good idea of what a Mac user would add to this list? Probably the .xcodeproject but anything else?