What happens is I get → “SpawnActor failed because no class was specified”.
I believe I have made sure that correct GameMode_BP is in Project Settings, and in GameMode I have set correct Class to be spawned.
you could add a BeginPlay in your GameMode Blueprint and add a Print Text there to see if that’s being executed.
I would guess that you’re not running the game mode blueprint, but rather running the base.
You could also declare your game mode as abstract, so it can’t be instanced incorrectly.
This wont report any logs nor spawn, but I think you are correct with this code, it should work.
I think GridClass is nullptr, and that is because GameMode is “HOMM3GameMode” not “HOMM3GameMode_BP”. BP version has GridClass set, I dont know why it is running the base version of GameMode instead of _BP because I have set it to use _BP in Project Settings.
I also tried to log message in HOMM3GameMode_BP at BeginPlay and this wont log. So I’m pretty sure it’s using C++ version of GameMode, ignoring that I have it set to BluePrint version in ProjectSettings. I dont know how to fix that
I went to “World Settings” and put GameMode override to my BluePrint versions and after that everything works!
Beats me why it didnt work through ProjectSettings
Perhaps you set the c++ version of your game mode class in your project settings (which has an uninitialized tsubof variable) in place of the bp version where it is set?
I think at some point I mustve accidentally set in the World Settings → Game Mode Override, my C++ GameMode Class. It seems once this was set, it didnt matter what was in Project Settings.
Now I changed World Settings → Game Mode Override to None, and now Project Settings works again. What I choose now as default in Project Settings will be used.
As to when / why I had put the World Settings → Game Mode Override to C++ Class I do not know. Probably at the start of the project I looked at World Settings and maybe there I set it accidenttaly.
But thank you for replies! As a plus you showed me a cleaner version of my spawning code