Hello,
I’ve been trying out my game on mobile and I’ve noticed that I cannot spawn some objects. I’m loading a blueprint class inside c++ code outside of the constructor by using LoadClass()
. Here’s the code:
void ATPSWeapon_Projectile::SetProjectileType(FString ProjectilePath)
{
ProjectileClass = LoadClass<ATPSProjectile>(NULL,
*ProjectilePath, NULL, LOAD_None, NULL);
ATPSProjectile* const MyProjectile = GetWorld()->SpawnActor<ATPSProjectile>(ProjectileClass, FVector(0, 0, 0), FRotator(0, 0, 0));
if (MyProjectile)
{
SetPossessStatus(MyProjectile->ShouldBePossessed);
MyProjectile->Destroy();
}
}
This works fine when I’m previewing on my PC, but when I launch on mobile or even build the .apk the game cannot find the blueprints I specified. It kind of makes sense to me since I’m providing a path that is valid only on my PC. I want to know how I can fix the said issue. I guess I could expose my object in Editor and assign the BP there, but I really want to avoid doing that. Any ideas?