Create UMG in C++ Editor

Hi everyone,

I want to make some editor code to make the same behaviour than the Vuforia Unity’s plugin but for ARCore. To explain, the designers need to be able to place markers inside the main viewport and place theirs assets according to the selected markers so to do so I have my ARMarker and every actor which will be child of it will have its transform stored in a dictionnary based on the GetImageIndex function of the ARCore api.

The main scenario :

  • The designer take the ARMarker_BP and place it in the world
  • He choose which image will be used to track at this point (he can place its ARMarker wherever he wants it’s not important)
  • The image is displayed in the world (with an editor only widget component if it’s possible, for the moment a widget Visible and Hidden In Game will be enough)

All the project is in C++

Currently I’m stocking at creating the widget, I’ve tried make a BP of ARMarker(Actor) and MarkerWidget(UUserWidget), and set everything in DefaultsOnly but no CreateWidget still null same as m_markerWidget.

Here is my code :


#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "ARMarker.generated.h"

class UWidgetComponent;
class UMarkerWidget;
class UUserWidget;

class ARTEMPLATECPP_API AARMarker : public AActor
	// Sets default values for this actor's properties

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

	// The image to use for editor display
	UPROPERTY(EditInstanceOnly, Category = "ArchiReality|Marker")
		UTexture2D* m_pTexture = nullptr;

	UPROPERTY(EditDefaultsOnly, Category = "ArchiReality|Marker")
		TSubclassOf<UUserWidget> m_markerWidget;

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

	USceneComponent* m_pSceneComp;

	UUserWidget* m_pMarkerWidget;

	//UMarkerWidget* m_pMarkerWidget;



#include "ARMarker.h"
#include "Components/WidgetComponent.h"
#include "Blueprint/UserWidget.h"
#include "MarkerWidget.h"

// Sets default values
 	// 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;

	m_pSceneComp = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComponent"));
	RootComponent = m_pSceneComp;

	m_pWidgetComp = CreateDefaultSubobject<UWidgetComponent>(TEXT("MarkerRepresentation"));
	m_pWidgetComp->bVisible = true;
	m_pWidgetComp->bHiddenInGame = true;
	m_pMarkerWidget = CreateWidget<UUserWidget>(GetWorld(), m_markerWidget);

	//m_pMarkerWidget = CreateWidget<UMarkerWidget>(GetWorld(), m_markerWidget);



// Called when the game starts or when spawned
void AARMarker::BeginPlay()

// Called every frame
void AARMarker::Tick(float DeltaTime)


I’m really confused with UMG with C++, everyone seems to have it’s own implementation of it. I’ve also tried Slate but same results.

Anyone has an idea to accomplish that ?

Best regards everyone,