I’m successfully spawning pawns using this code I have in one of my classes:
GetWorld()->SpawnActor<ANpc>(NpcBlueprint, location, rotation, spawnInfo);
This works as expected, and I can see Npcs appear when running my game.
But as soon as I move this code to the GameMode class (I need a class responsible for spawning NPCs), it fails with: “SpawnActor failed because no class was specified”
NpcBlueprint
comes from a UPROPERTY, and this is definitely set correctly in the GameMode blueprint, in the exact same manner as the successful case.
For some reason it works fine in other classes, but when I put it in GameMode (either BeingPlay or even Tick), it simply doesn’t work. Is it something to do with blueprints from GameMode behaving differently?