What do? If I can't use ConstructorHelpers::FObjectFinder? Will the cooker ignore this later on?

I have some Actor. This actor represents all the items in my game that can be picked up.


class APickupActor: public AActor

In the constructor I use


static ConstructorHelpers::FObjectFinder<UStaticMesh> DefaultSphereVisualAsset(TEXT("/Game/Defaults/BasicSphere.BasicSphere"));
...
m_meshComponent->SetStaticMesh(DefaultSphereVisualAsset.Object);


So that it has some default mesh, in case something breaks later on. Hopefully no one ever sees this mesh.

At some point I instantiate this dynamically created actor. Then set a value on it


somePickupActor.SetItem(item);

Inside SetItem(item), I go and find out everything extra this should have on it, perhaps add some more components, and update it’s mesh.



// This queries a data asset/json/file for what the mesh should be.
// For example, newMeshString = "/Game/Items/GoldCoin.GoldCoin"
FString newMeshString = ItemDB.GetMeshString(item);

auto newMesh = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, TEXT(newMeshString)));
m_meshComponent->SetStaticMesh(newMesh);

ItemDB is basically powered by an external json that will eventually have some mod-ability support for people to make new items.

This all works just fine for now.

But then I see posts like this
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/28489-umg-and-inventory-slots?57678-UMG-and-Inventory-slots=&viewfull=1
"
The reason is that once you start cooking your game, asset references defined in this way are completely invisible to the cooker. Cooking only cares about assets you’re actually using, otherwise you’d end up shipping cooked games with piles of data that isn’t actually used anywhere. "

Is this going to be a problem for me or is there a better way of doing this?
Is there a way to make sure I am cooking in the relevant assets? Do I need to make a dummy object that just loads all my meshes(and other assets somewhere)?

In project settings you can pick folders to always be included.

And if you don’t want to be tied to a specific folder in the asset browser, you can create an empty level and dump all your required assets in it and then add it to the list of maps to cook in the project settings under ‘packaging’.

Thanks both! Both great ideas and will do that!