The BeginPlay() can't be fired when I using a class derived from the Character as the Default Pawn Class

Good evening, everybody! I have encountered a problem about [link text][1]. At the setp1 of section 2, I was asked to create a c++ class derived from the “Character”, and convert it to a blueprint, and assign it to the “Default Pawn Object” which can be found in “Project Settings”. I finished. But for the life of me, I found the output message I had written in the “BeginPlay()” had given out entrily! Because the “BeginPlay()” was not fired. It took me almost 3 hours… Up until now, I still have no solution for it… Is there anything I missed…? Could anyone help me?

#include "GameFramework/Character.h"
#include "FPSCharacter.generated.h"

UCLASS()
class FPSGAME_API AFPSCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AFPSCharacter();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

};

AFPSCharacter::AFPSCharacter()
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void AFPSCharacter::BeginPlay()
{
	Super::BeginPlay();
	if (GEngine)
	{
		GEngine ->AddOnScreenDebugMessage(-1, 5, FColor::Yellow, TEXT("Good, I'm character!"));
	}
}

// Called every frame
void AFPSCharacter::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

// Called to bind functionality to input
void AFPSCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

}

131364-2017-03-23_20h08_18.png

131365-2017-03-23_20h07_52.png

Is all this code from one file? line 1-23 should go in the .h and 24-end should go in the .cpp. I’m not sure if this makes a difference for the compiler though, it should not.

It’s my fault. It was the first time I posted a question with codes. They were split into deferent files in real project.

Can you check that your BP_MyFPSCharacter actually derives from AFPSCharacter? Alternatively, what happens when you set the Default Pawn Class to AFPSCharacter instead of the Blueprint?

The matter have already solved!

Yes, I checked. In My class of GameMode, there is no Super::StartPlay() called from the method that had been overwritten, and that is where the problem lay! I guess that all the “BeginPlay” events will be fired from here. Thank you for you suggestion!

could you share your solution??

Certainlly, But I am not sure whether this is the key for your matter.
Before I Created the class of “Character”, I had created the class of “GameMode” in, and had overwritten the function “StartPlay” to output something. It’s the way we must be to follow the tutorial, but to very key something, the function call of “Super::StartPlay” was left out. and that’s the trouble.
In addition, I suggest you to do something in the blueprint of class of your “GameMode” . reset the “Default Pawn Class” to your something you wanna, and to click compile button once more.
In my case, the rest was plain sailing.
I hope the replies can help you!