FObjectFinder in UE5 cannot find any assets to load

Here’s the code that I’ve mostly copied from the C++ Getting Started tutorial:

AKart::AKart()
{
 	// 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"));
	SetRootComponent(VisualMesh);
	// VisualMesh->SetupAttachment(RootComponent);

	static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeVisualAsset(TEXT("StaticMesh'/Engine/BasicShapes/Cube.Cube'"));

	if (CubeVisualAsset.Object) {
		UE_LOG(LogTemp, Warning, TEXT("THERES AN OBJKEC THERE???"));

	}
	UE_LOG(LogTemp, Warning, TEXT("TESATING @#!# TEASTIG"));


	if (CubeVisualAsset.Succeeded())
	{
		UE_LOG(LogTemp, Warning, TEXT("SUCCEEDED!!!"));
		VisualMesh->SetStaticMesh(CubeVisualAsset.Object);
		VisualMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
	}

}

The rest is exactly as it is on the page: Unreal Engine CPP Quick Start | Unreal Engine 5.2 Documentation

The only difference is that I added some logs to verify I’m seeing what I’m seeing.

I’m using the engine cube here as the path, but I’ve used my own imported models too.

I’ve made sure to try different variations of the path in case I was having a formatting issue.

Nothing. The model I want to be down, is not showing. The model exists in the content explorer, and I can attach it to my actor manually. I want to do it through C++ though, and it’s just not working at all.

No matter what I put in the FObjectFinder parameter, no asset is found.

Any idea why? This is a completely fresh install of UE5, literally just started to learn it today and I cannot get past this tutorial.

On top of that UE5 keeps crashing on the right-click menu for actors in the Outliner. No solution for this either.

This is on Windows 10. I’ve updated fully my AMD graphics card (that helped get rid of some of the crashes) and have reset its graphics settings to default (as per a suggestion on here) and that helped a little bit more.

I still get crashes from right-click menus - this couldn’t be more infuriating as a new developer ngl.

Any ideas?

If you are using Live Coding, you may run into issues with FObjectFinder not being able to find valid assets if either the C++ class or asset you are loading did not exist at session start. Closing the editor, building the project in Visual Studio, and re-launching fixes the issue.

I’ve also not had luck using engine assets, and maybe that’s intentional on Epic’s part so people don’t start taking dependencies on their internal editor assets. The page you linked uses assets in StarterContent rather than Engine presumably for this reason: Game/StarterContent/Shapes/Shape_Cube.Shape_Cube. You should be able to duplicate any of their editor assets into your game content folders though.