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.