Get game path

While in UE Editor, the blueprint Get Project Directory returns exactly what I want, the path in which the project is located (as example let’s say: E:/Unreal projects/TestProject), but when creating the shipping game, then that blueprint returns E:/Games/TestProject/TestProject (which contains Binaries and Content folders) and not the path in which the .exe file is, which I was hopping it would do (E:/Games/TestProject/).

Is there a blueprint that return in editor the same thing as Get Project Directory does, but in the shipping form, it will return the path to where the exe is?

It kinda is a pain in testing to work with a path, and then to remember to cut from the path Get Project Directory return, the last folder from path to end up with the location of the exe.

Hi @Valentinvis, If you want to get the path where you run the game, you can use Launch Dir.

1 Like

Unfortunately that doesn’t work. If the project is launched from Editor (Play this level) it will point to where UE is installed (the engine not the project), if I launch the project using context menu from ProjectName.uproject (Launch game) then it returns Windows/System32.
I came up with a template that I only need to change a link when switching to shipping form. And in case I forget I get an error that will tell me to change the link.

Rama’s victory plugin has this node

image

this is the code of the function in C++

FString myPath = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir());

more info here:

1 Like

I ended up using “Is Packaged for Distribution” to check if I’m in editor or not, then I created a branch off of that.

image

If it is true and I’m not in editor but on a shipping form of the game:


With this I’m getting the location of the project and from that I’m removing from the end the folder so I end up in the location with the exe file. The last “GetSubstring” return value has the location.

If it is false then I’m in editor, so I can simply use “Get Project Directory”.

image

2 Likes


try this node, it’ll return C:\Users{username}\Documents, you can use it to read or write files to that location

This is an old thread, approaching 3 years, which already has an answer, and what you wrote doesn’t have anything with what I was asking.

By default Unreal Engine creates its save files/crashes in AppData\Local when packed, so you don’t even need to access Documents folder.

Maybe you wrote it in the wrong thread?