unreal engine

Step 1: Include necessary header files

#include "YourGameMode.h"
#include "YourCharacter.h"

Step 2: Define your custom GameMode class

class AYourGameMode : public AGameModeBase
{
    GENERATED_BODY()

public:
    AYourGameMode();
};

Step 3: Implement the constructor for your custom GameMode class

AYourGameMode::AYourGameMode()
{
    // Set the default pawn class to your custom character class
    DefaultPawnClass = AYourCharacter::StaticClass();
}

Step 4: Compile and save your custom GameMode class

Step 5: In the Unreal Engine Editor, set your custom GameMode class as the default GameMode for your project.

Step 6: Build and run your project to use your custom GameMode with your custom character class.