GENERATED_BODY vs GENERATED_UCLASS_BODY

Hello, ubi

Please note that with GENERATED_BODY(), a constructor is no longer necessary for each class (however, if you need a constructor, you can declare and define it as usual).
The other difference is that, in comparison to GENERATED_UCLASS_BODY(), GENERATED_BODY() doesn’t have the public specifier in it, so any class members that are declared after it are private by default (you can explicitly declare them as public).
In your situation, please make sure that you have your constructor declared and defined correctly:

//.h file
//...
	GENERATED_BODY()
	
public:
	AFPSGameMode(const class FObjectInitializer& ObjectInitializer);

// .cpp file
AFPSGameMode::AFPSGameMode(const class FObjectInitializer& ObjectInitializer)
{
       // constructor functionality
}

Hope this helped!

Have a great day!

8 Likes