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:

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

	PrimaryActorTick.bCanEverTick = true;

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

	Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));


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

class DRONE_API ADronePawn : public APawn

	// Sets default values for this pawn's properties

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

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

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

	USceneComponent* Root;

	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: