Ok I fixed my issue; posting here in case someone down the line finds it helpful ![]()
Using object finder will not work for cooked/launchable games because it’s reliant on that blueprint having been cooked before runtime and isn’t findable, so only seems to work in the editor from my understanding. Instead, I needed to use EngineUtils::ATL_Class as explained here. So for example, to find my BP, this worked:
TArray<UObject*> bps;
if (EngineUtils::FindOrLoadAssetsByPath(TEXT("/Game/Beachballs"), bps, EngineUtils::ATL_Class)) {
for (int i = 0; i < bps.Num(); ++i) {
UObject* temp = bps[i];
if (temp == NULL || (temp->GetName().Compare(TEXT("SingleCannon_C")) != 0))
{
continue;
}
else {
MyBeachballCannonTemp = (UClass*)temp;
}
}
}
The way to improve this is to template it if you need to find a bunch of BPs and to not hardcode the .Compare text like I did - see the link. This is how my subclass actor looks in my header so that I can spawn it whenever needed:
TSubclassOf<class AActor> MyBeachballCannonTemp;
and when I need to spawn the blueprint object:
AActor* BeachballBP;
FVector BeachballSpawnPoint = FVector(Mesh->GetSocketLocation("MidPoint").X-(SizeOfSquare*PercentageTemp), Mesh->GetSocketLocation("MidPoint").Y, Mesh->GetSocketLocation("MidPoint").Z + 380.0f);
BeachballBP = CreateBeachballCannonAtLoc(BeachballSpawnPoint);