Is there any UE4 equivalent to Unity's "StreamingAssets" folder / "Application.streamingAssetsPath"?

For those who aren’t familiar, Unity’s “StreamingAssets” has nothing to do with streaming.

Unity’s “StreamingAssets” allows files to be placed into a directory in the project called “StreamingAssets”. Those files are not imported into the editor. When packaging a build, those files are placed (unpackaged) into the build without being archived/packaged up. You can use Unity’s “Application.streamingAssetsPath” to access the file in both in the editor and in the packaged build with the same relative path.

I haven’t yet found anything similar to Unity’s “StreamingAssets” nor Unity’s “Application.streamingAssetsPath”.

This is the closest thing to a solution that I’ve found:

  1. Package a game, find the “RunUAT.bat” command in the output log, and copy it.

  2. Create a python script that runs the “RunUAT.bat” command and then places the external files into “{build_dir}\WindowsNoEditor\{project_name}\Binaries\Win64\{external_filename}”, next to the .exe file. Now FFileHelper can access the external file with a relative path (path is “.\{external_filename}”)

  3. Package a build using the python script from now on.

This solves most of the problems, but it does not allow me to use a relative path in the editor, since when using FFileHelper in the editor, all filepaths are relative to “{unreal_editor_installation}\Engine\Binaries\Win64”.

So, my questions are:

  1. Is there any way to automatically include an external (non-imported) file into a UE4 packaged build, and have it not be placed in a pak file?

  2. Is there a way to have FFileHelper access this file in both the editor and in a packaged build without knowing the filepath for the Unreal installation nor the filepath for the packaged build?

1 Like

To answer your second question (#2, filepaths): FPaths::ProjectDir(), when used in the Unreal Editor, will return the directory containing your .uproject file; whereas if FPaths::ProjectDir() is used in a windows built/packaged game, it will return <buildDir>\WindowsNoEditor\<yourProjectName>\ .

From the blueprint side, you can access FPaths::ProjectDir() by using Rama’s Victory plugin:
https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/4014-39-rama-s-extra-blueprint-nodes-for-you-as-a-plugin-no-c-required

The Project directory can be access with the BP node “Victory BP Library / Paths / Victory Paths Game Root Directory”

This sounds like primary data assets and the asset manager. Which can load and unload assets automatically or through scripting, and which you have to tell the asset manager the assets directory and weather or not you want the assets to be cooked and packaged with the build or not.

You can put static resources in the Movies directory.