C++ get Actor from Default UE4 Character


UE4 provides this UE4 Default BP Character, which is automatically created when I hit “Play” in the UE4 Editor.

As far as I know, the following code, creates the character for me:

static ConstructorHelpers::FObjectFinder<UClass> PlayerPawnBPClass(TEXT("Class'/Game/Blueprints/MyCharacter.MyCharacter_C'"));
if (PlayerPawnBPClass.Object != NULL)
	DefaultPawnClass = PlayerPawnBPClass.Object;

My Question is:

How do I get the Actor from this Code?, because I need the Actor from it and add it to a TArray .

I thought the DefaultPawnClass is the key, but somehow I can’t find any solution.

Another Question:

Is this actually the right way to add my Character / Actors to the map?
Because I’ve also read a lot about the SpawnActor functions…

Can anyone help?

maybe I’m even wrong, but I have no Idea how to get the automatically spawned Character.

Isn’t this code in your GameMode? This only defines which BP you want to spawn.
If you want to get your character, you can get him like this:


With this you should save the character in a TArray.

Is that what you wanted?