I’ve created game instance subsystem C++ class which adds specific logic to be run before every spawned actor is initialized. Please see piece of code below. It works good when I run my game in PIE mode in Unreal Engine on PC. But when I deploy it on my Android, game never goes inside of Lambda which I added to OnActorPreSpawnInitialization. Did somebody face similar issue?
void UMyGameInstanceSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
auto ActorSpawnLambda = FOnActorSpawned::FDelegate::CreateLambda([this](AActor* InActor)
{
UE_LOG(LogTemplateCBGameInstanceSubsystem, Warning, TEXT("Run lambda Starting point"));
if (AChaosCachePlayer* CCP = Cast<AChaosCachePlayer>(InActor))
{
if (ChaosCacheCollection_Temp)
{
UE_LOG(LogTemplateCBGameInstanceSubsystem, Warning, TEXT("Run lambda from class UMyGameInstanceSubsystem "));
PostSpawnChaosCachePlayer(CCP, ChaosCacheCollection_Temp);
ChaosCacheCollection_Temp = NULL;
}
}
});
UE_LOG(LogTemplateCBGameInstanceSubsystem, Warning, TEXT("GameInstance subsystem is Initialized"));
GetWorld()->AddOnActorPreSpawnInitialization(ActorSpawnLambda);
}