Hello, I’m struggling to find a way to pass a TCHAR with the path of the file to LoadObject. All the examples that I’ve seen are passing a fixed path like:
It seems that option 2 is actually working correctly. I keep this question open since I wasn’t able to find the right way to load assets without hardcoding the file path.
Please provide anyway feedback if you see any issue with this approach to assets loading.
You can use TSoftObjectPtr property in your blueprint to store a path to objects in your content folder. If you move these objects around in the editor the paths will automatically update plus you can load the objects only when you need them. The downside is that as your project grows this doesn’t scale very well.
A better way is to customize UAssetManager for your project and use the FPrimaryAssetId system. This lets you use string identifiers to stream in any asset in your game on demand. But it requires a bit of setup and planning to work correctly.