Hi,
You are spawning your actors in your game mode (I guess you have set this GameMode
to be the mode used in your level). To access your game mode you have to do something like:
ABallCrusherGameMode* GameMode = Cast<ABallCrusherGameMode>(GetWorld()->GetAuthGameMode());
Remember to check that GetWorld()
is not null to avoid crashes. Another thing you have to take into account is that the GameMode
is only available on the host instance, so in a server/client scenario clients won’t have an instance of it. If you are creating a network game you have to track your actors in something that you have in both sides like the AGameState
which is replicated.
Hope I could help you out.