C++ created pawn is not saved in the editor

Hello, apologies if it’s a redundant question, but i have tried many times without success to find a thread that would solve my problem.

I have created a blank C++ project and added a Pawn via the C++ class wizard, then added a Root component and a StaticMesh component, like so:
DronePawn.cpp:

#include "DronePawn.h"
#include "Components/StaticMeshComponent.h"

ADronePawn::ADronePawn()
{
	PrimaryActorTick.bCanEverTick = true;

	Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
	RootComponent = Root;

	Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	Mesh->AttachTo(Root);
}

DronePawn.h:

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "DronePawn.generated.h"

UCLASS()
class DRONE_API ADronePawn : public APawn
{
	GENERATED_BODY()

public:
	// Sets default values for this pawn's properties
	ADronePawn();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

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

	UPROPERTY(EditAnywhere)
	USceneComponent* Root;

	UPROPERTY(EditAnywhere)
	UStaticMeshComponent* Mesh;
}

Then i drag my pawn into the viewport to add it to the world outliner, save the project, compile, successfully.

The problem is that when i reopen the project the Pawn has disappeared from the viewport and world outliner, and none of my additions in the editor are saved.

Do i need to add additional code to make this persistent?

Thank you for the attention.

Are you sure you’re saving the level that this new actor is contained in?

I realise you said that you “Save the project”, but are you using “Save All” or “Save All Levels”?

Do you get a prompt to save your level when you close without saving the change?

Sure! If you go to Edit → Project Settings → Maps & Modes

You can select your default Editor Startup Map and Game Default Map.

Yes I am, I always use the “Save All” option.

I realize now that i have to manually load the level i saved to see the environment i created, and my changes are correctly loaded.
But the project initially opens with the blank, default level. Is there any setting i need to change to make my saved level the default one?

EDIT: Found it in “Project settings” → Maps and modes → Default maps
And selected the ones i saved.

I solved the issue :slight_smile: