Event BeginPlay not firing

Ok So I have racked my brains all night with this problem. I cant get Event BeginPlay to fire no matter what I do. I have GameModeBase and GameStateBase calling Super::BeginPlay() and Super::StartPlay(). I also have added a Parent: BeginPlay node in the blueprint editor with no success. Can anyone help me?

Thanks,

I know this sounds abit simple but did you check to see that youre actually using that GameMode when your running the game?

Yes. However, it is my own custom gamemode.

Each Level can override which GameMode it is using so either ensure that it is overriding with your Blueprint version of the GameMode or it is not overridden but set in “Maps & Modes” in the Project Settings.

Yes its set in maps and modes and blueprint world override

Make sure that if your GameMode inherits from GameMode that GameState inherits GameState and not GameStateBase. GameMode and GameState has to use the same variant.

My GameModeBase inherits from GameModeBase and my GameStateBse Inherits from GameStateBase

I tried it in a new project 4.22 and it all works.
Try print node before Event beginplay in GameStateBase, play and see if you get a message on the screen. (Also remove the override in WorldSettings.) If not then you didn’t set your project settings right. Check that everything is set right. If it still doesn’t work make a screenshot of GameStateBase and the Project settings so we are sure it’s not a problem on your end. (Take the screen-shots exactly like I did in the pictures and also the WorldSettings GameModeOverride)

Okay and you are sure there is no run-time errors? Perhaps post a picture of what you got.

this is what i’m trying to do. set a gameinstance vafriable

282255-mapsandmodes.jpg

Ok so I’ve promoted MyGameStateBase to a blueprint but it still doesnt print anything and i’m sure i have everything setup properly could it be something in my c++ code then?

If it is based on your own C++ GameModeBase and or GameStateBase then yes. Check if HandleBeginPlay is getting called in your GameState. If you are overriding HandleBeginPlay you have to call the Super class.

You 100% you calling Super::BeginPlay() on BeginPlay override?

My GameStateBase.h:

UCLASS()
class CUBEFACTORY_API AMyGameStateBase : public AGameStateBase
{
	GENERATED_BODY()
		virtual void HandleBeginPlay() override;
};

My GameStateBase.cpp

void AMyGameStateBase::HandleBeginPlay() {
	Super::HandleBeginPlay();
}

If you aren’t doing anything with the override you could also just delete the function so it isn’t overridden.
How about your constructor? can you show the code for that? please use the code tags so it is easier to read.

HandleBeginPlay is public btw (see line 5)

 UCLASS()
 class CUBEFACTORY_API AMyGameStateBase : public AGameStateBase
 {
     GENERATED_BODY()
public:
         virtual void HandleBeginPlay() override;
 };

Ok So I removed the override because it wasnt being used. There is no constructor I dont know if that makes a difference but anyway

Yes I am sure.

Only other thing I can think of is you might have overridden tick and not called super, if thats even a thing.