"Programming Quick Start" doesn't works (UE 5.2)

Hey there,

I’m trying to deal with the Programming Quick Start, but the cube doesn’t appear.

After some tests, the problem looks to be from the line below:

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));

I searched in the forums, but I cannot find something working.

This is my class constructor:

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

	VisualMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	VisualMesh->SetupAttachment(RootComponent);

	static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));

	if (CubeVisualAsset.Succeeded())
	{
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, "CubeVisualAsset.Succeeded()");
		VisualMesh->SetStaticMesh(CubeVisualAsset.Object);
		VisualMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
	}
	else {
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, "else");
	}

}

When running in editor, the “else” debug statement is returned.

I tried to use many different mesh references:

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube"));

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("'/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube'"));

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Script/Engine.StaticMesh'/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube'"));

But nothing worked. When I manually apply the Static Mesh, it’s working.

Thank you.

Resolved. The problem was related to the Live Coding feature. I disabled it, and used the Hot Reload feature instead.

EDIT: I found some more explanations about it. When using Live Coding, if you change your class constructor, you need to close the editor, build your class using VS, and restart the editor. The Tick event can be handle using Live Coding for example, but not the constructor.

I had the same problem, and then I disbaled Live Coding. Now I only use VS to build the project while UE5 is off.
Here is the correct code for cube’s initialization:

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube"));

with “Game” is “Content” folder in Content Drawer. Information for anyone who needs it.