Hi. I have a player controller class on which i have created a pointer of type Widget. When i create a blueprint based off my code and try to assign a Widget_blueprint (previously created) into it and compile the variable always gets reset to none. I Don’t know what i am doing wrong. Here’s My Code
MyPlayerController.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "MyPlayerController.generated.h"
/**
 * 
 */
UCLASS()
class DARKHORSEUNREAL_API AMyPlayerController : public APlayerController
{
	GENERATED_BODY()
public:
	
	//Constructor
	AMyPlayerController();
	//Begin Play Function
	virtual void BeginPlay() override;
	//Tick Function
	virtual void Tick(float DeltaTime) override;
	UPROPERTY(EditAnywhere)
	class UUserWidget* InfoWidget;
	
};
MyPlayerController.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyPlayerController.h"
#include "Blueprint/UserWidget.h"
AMyPlayerController::AMyPlayerController()
{
	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
}
void AMyPlayerController::BeginPlay()
{
	Super::BeginPlay();
	if (InfoWidget)
	{
		InfoWidget->AddToViewport();
	}
}
void AMyPlayerController::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}