UWidgetComponent not showing details in Blueprint editor (C++)

Why are none of the overheadDialogueWidgetComponent details available to edit in the blue print editor?

header:

class ABasePaperCharacter : public APaperCharacter
{
	GENERATED_BODY()
private:
	UDialogueComponentWrapper* dialogueComponentWrapper;
...

cpp:

ABasePaperCharacter ::ABasePaperCharacter ()
{
	this->dialogueComponentWrapper = NewObject<UDialogueComponentWrapper>();
	this->dialogueComponentWrapper->SetUpDialogueComponents(FObjectInitializer::Get(), this->GetRootComponent());
...

header:

UCLASS()
class UDialogueComponentWrapper : public UObject
{
	GENERATED_BODY()

public:

    void SetUpDialogueComponents(const FObjectInitializer& objectInitializer, USceneComponent* componentToAttachTo);

private:

    UPROPERTY(Instanced, EditAnywhere, BlueprintReadWrite, Category = "Dialogue", Meta = (AllowPrivateAccess = true))
	UOverheadDialogueWidgetComponent* overheadDialogueWidgetComponent;

...

cpp:

void UDialogueComponentWrapper::SetUpDialogueComponents(const FObjectInitializer& objectInitializer, USceneComponent* componentToAttachTo)
{
	this->overheadDialogueWidgetComponent = objectInitializer.CreateDefaultSubobject<UOverheadDialogueWidgetComponent>(objectInitializer.GetObj(), TEXT("Dialogue widget component"));
	this->overheadDialogueWidgetComponent->AttachToComponent(componentToAttachTo, FAttachmentTransformRules::KeepRelativeTransform);
}

header:

UCLASS()
class ECDD_API UOverheadDialogueWidgetComponent : public UWidgetComponent
{
	GENERATED_BODY()

};

Hi jimmyt1988,

  1. The difference between UWidgetComponent and UWidget is that UWidget is used to derive child classes that get used to expose Slate functionality in the UMG designer and can’t be used in game. While UWidgetComponent is used to render the UUserWidget (Widget BP) on screen or in the world.
  2. I think you might be missing the Category metadata for your widgetComponent variable declaration and you might also need to add U in front of DialogueComponents as that is what UHT requires and UCLASS() above it (it might also be missing more metadata).

Hope that helps. Cheers,

Thanks, i’m glad you mentioned UUserWidget, that’s exactly what i wanted to compare the UWidgetComponent with. I’ll check out what you said abotu the Category when i get home :slight_smile:

P.S I edited my question to include these 2 details.

To be able to see the details use VisibleAnywhere instead of EditAnywhere

That doesn’t seem right:

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Properties/Specifiers/EditAnywhere/index.html

Thanks though! :slight_smile:

I’ve revamped my question, I can see how you would have thought Category might help… I found that without declaring it, it will not appear in the listed add components, hopefully my new images make you understand better what I mean. Thanks for the help! Any ideas?

Sorry I confused myself there, use EditDefaultsOnly

EditDefaultsOnly restricts the property to be present on instances. EditAnywhere allows it to be edited anywhere.

I’m still stuck on this. d’oh. Any ideas guys? Am I limited to using a USTRUCT to make this possible or something?

I was able to repro this behaviour with your example, and have not yet been able to pin down a cause yet. I’ll investigate some more and let you know.

Try

 class ABasePaperCharacter : public APaperCharacter
 {
     GENERATED_BODY()
 private:
     UPROPERTY(EditAnywhere)
     UDialogueComponentWrapper* dialogueComponentWrapper;

Unfortunately this does not change anything (EDIT) Although not the actual issue, I think it’s key to keep this here and remind people it is required. So thank you for mentioning it.

Warning, there are no answers here, only defeat…

ABasePaperCharacter:

UCLASS()
class ECDD_API ABasePaperCharacter : public ABasePaperCharacter
{
	GENERATED_BODY()
public:
	ABasePaperCharacter()
	{
		this->dialogueComponentWrapper = CreateDefaultSubobject<UDialogueComponentWrapper>(TEXT("Dialogue component wrapper"));
		this->dialogueComponentWrapper->AttachToComponent(this->GetCapsuleComponent(), FAttachmentTransformRules::KeepRelativeTransform);
		this->dialogueComponentWrapper->SetUpDialogueComponents(FObjectInitializer::Get(), this->dialogueComponentWrapper);
	}
private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue", Meta = (AllowPrivateAccess = true))
		UDialogueComponentWrapper* dialogueComponentWrapper;
}

UDialogueComponentWrapper - Notice the USceneComponent inheritance:

UCLASS()
class UDialogueComponentWrapper : public USceneComponent
{
	GENERATED_BODY()
public:
	UDialogueComponentWrapper();
	void SetUpDialogueComponents(const FObjectInitializer& objectInitializer, USceneComponent* componentToAttachTo)
	{
		this->overheadDialogueWidgetComponent = objectInitializer.CreateDefaultSubobject<UOverheadDialogueWidgetComponent>(objectInitializer.GetObj(), TEXT("Dialogue widget component"));
		this->overheadDialogueWidgetComponent->AttachToComponent(componentToAttachTo, FAttachmentTransformRules::KeepRelativeTransform);
	}
private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dialogue", Meta = (AllowPrivateAccess = true))
		UOverheadDialogueWidgetComponent* overheadDialogueWidgetComponent;
};

UOverheadDialogueWidgetComponent:

UCLASS()
class ECDD_API UOverheadDialogueWidgetComponent : public UBaseWidgetComponent
{
	GENERATED_BODY()
};

All of the above ends up with this:

I still had the issue of the component not showing details inside its details panel, but atleast I could now change the details.

I still have no idea why I cannot see the component’s properties in the detail panel… but atleast I can continue to make my game.

Don’t you need to use CreateDefaultSubobject instead of NewObject?

Ah, well, the point was that the UDialogueComponentWrapper was simply to be a structure that holds details of the various bits and bobs required for dialogue… and yet can still itself be instanced. If you check through my question revisions you’ll see why I ended up at that place to try and clarify the question. But you can now see my “answer” that does indeed use CreateDefaultSubobject to instantiate a USceneComponent.

Thank you very much. I’ve actually supplied an “answer” which may make more sense to attempt from?

Reparent your object on another Class (Actor for i.e.) and then reparent to needed class again. It helped me.

1 Like