After looking more into the error I was getting, I noticed a line ‘LogLandscape: Warning: Landscape : Nanite landscape mesh would have more than 64 materials, which is currently not supported. Please reduce the number of components in this landscape actor to enable Nanite.’
After, I backed up my landscape and deleted it in my project. BOOM! Game packed fine.
So I lowered the amount of components to ‘64’ and now my game is packaging as expected.
I’m not sure if what was causing this error for me is the same for others, but I thought I’d put this out there in case it helps anyone. (It involved me compiling the engine from source so I could add some extra print statements ).
I have an actor that needs to dynamically add static mesh components at runtime. To avoid a hard reference to a static mesh asset in C++, I exposed a property that could be set in a BP child:
Turns out you should not initialize a UStaticMesh* with CreateDefaultSubobject. Make it nullptr instead (MeshAsset = nullptr) and it will be correctly initialized later when the BP is initialized.
It’s odd that this never caused an issue until I tried packaging.