SpawnActor fails when run from the GameMode class

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?

It’s probably something silly like you didn’t include a header or something.

Hmm no way to get any more information than the console output? I’ve checked the headers and they match the successful case.