How to create a constructor in GameStateBase?

How to create a constructor in GameStateBase and enable Tick()?

130867-cpp.png

130870-gsb.png

In contrast to the old GENERATED_UCLASS_BODY() macro, GENERATED_BODY() does no longer declare the constructor for you, so you have to do it yourself:

UCLASS()
class GAME_API AMyGameStateBase : public AGameStateBase
{
	GENERATED_BODY()
	
public:
	AMyGameStateBase();
};

AMyGameStateBase::AMyGameStateBase()
{
	PrimaryActorTick.bCanEverTick = true;
}
1 Like

This code causes crash((

From the stack trace it looks as if you’re trying to use a month that’s not between 1 and 12 in your Tick function.

I apologize. I did not notice.
Thanks you!

No problem. You’re welcome :slight_smile: