Hi,
I have a problem when I package my game. I made some functions to load dynamically objects and materials in my level:
FActorSpawnParameters SpawnParams;
FStringAssetReference chargeReference = path;
/*Method 1*/
StaticLoadObject(UObject::StaticClass(), nullptr, *chargeReference.ToString());
UObject* chargeReferenceObj = chargeReference.ResolveObject();
/*---*/
/*Method 2*/
UObject* chargeReferenceObj = LoadObject<UObject>(nullptr, *chargeReference.ToString());
//PATH IS LIKE: TEXT("/Game/BlueprintsModelli/Mobile1.Mobile1"));
if (chargeReferenceObj) {
UE_LOG(LogClass, Warning, TEXT("OK"));
/*---*/
}
else {
UE_LOG(LogClass, Warning, TEXT("Error"));
}
Both of methods you see in the comments work perfectly in editor, but when I package they don’t. You can see an example path in comments, the path is the same, I do not use pak files, anyway there are 2 files instead of 1 when I package. One is a .uasset and one is .uexp.
Can you help me find the problem? Thank you very much and sorry for my English