How to properly package FSoftObjectPath references

Hi [mention removed]​,

PrimaryAssetLabel is a perfect way to go. In the PrimaryAssetLabel you can specify the exact assets you want to cook and they should get cooked and ready to use in a packaged application. From the configuration you have, both assets should get cokked, but if you try to access the PrimaryAssetLabel it will fail. For accessing it, you need to also enable the IsRuntimeLabel flag.

Then in the code, you can try to load the asset directly and see if it is able to do it. I’ll let you the code I’ve used as a SoftObject so you can test it yourself. In my case I’ve used two assets that are not being added to any level or either hard referenced by another blueprint.

The PrimaryAssetLabel:

[Image Removed]

The code to load it at runtime:

`void ATPP5_6Character::BeginPlay()
{
Super::BeginPlay();

FSoftObjectPath AssetPath(TEXT(“/Game/CookCase/LS_MyLevelSequence.LS_MyLevelSequence”));
UObject* LoadedAsset = AssetPath.TryLoad();

if (LoadedAsset)
{
GEngine->AddOnScreenDebugMessage(-1, 30.f, FColor::Red, FString(“Asset successfully loaded at runtime.”));
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 30.f, FColor::Red, FString(“Asset NOT loaded at runtime.”));
}
}`

In my case if I removed the assets from the PrimaryLabelAsset, I was not able to load them, so in my case the PrimaryLabelAsset is the responsible on making know the cooking process to also cook the ExplicitAssets.

Let me know if those changes worked for you. If not if you could make a repro project or give a bit more of information could be a great help.

Best,

Joan