Download

How should you format a file path being referenced?

I’m trying to use constructorHelpers FObjectFinder but I think I’m not giving my filepath correctly
Here’s my path:


I’ve tried referencing it like this:


static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeAsset(TEXT("Geometry/Meshes/1M_Cube.uasset"));

and I just get an error saying it cant find the mesh I’ve given, I’ve also tried giving the full path, with forward slashes and backward slashes.

Could anyone link me or explain to me how I should be formatting this?

You can right click an asset and copy the reference path inside the editor. It’ll give you the correct formatting - just take the portion of the string inside quotes.

I’ve tried this when I gave the full path and it doesnt like it. Do you think I’m just using the function wrong?
Here’s how Im doing it:


it runs fine but after compiling the editor brings this up:
UE4Editor_eDhR81cYLM.png

Oh. Are you copying that path from Windows Explorer? Do it in the Editor. Just right click on the asset in the Content Browser and hit ‘Copy Reference Path’. The string will contain a bit of extra stuff you don’t need. Just delete everything not in quotes.

Once you have it in your code, it’ll be easy to figure out the formatting for future.

oh I was clicking copy file path not the reference option above, thank you thats stumped me for almost a week XD