BP Class Default - Issue with UProperty flags

Hi,

I tried to use for the first time the GetClassDEfaults in BP of a C++ Class.

If you set:
/** Text to display on screen */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = “UI”)
FText DisplayText;

In the public part of your C++, it won’t show up in the node.
It seems that you must use BlueprintReadWrite flag to get it.

I’m not sure it’s a bug or not, but I can’t find any documentation on this. I thought that the output of a CDO should be readonly, but I may be wrong.

Thanks,

Hello,

I have added a couple of variables to a code class (FString and Float) and made them both Blueprint Read Only and Blueprint Read Write. When I created a blueprint based on my C++ class, I used the Get Class Defaults node, selected my code class from the dropdown, and my variables appeared.

If you select your code class (say MyActor if you are just using a basic actor class for testing), from the dropdown on the Get Class Defaults node, your variables that you have created in code should appear. If you set them to read only, you will not be able to alter the values by dragging off of the pin, as expected.

Have a great day

Hi,

I will try again but my setup is a little bit different.

  1. My C++ is a userwidget (UObject and not AActor).
  2. I created a BP of this UserWidget
  3. I’m using the Get Class Defaults on this BP class.

It might be that or not. This needs to be checked…

Thanks for the quick answer by the way.

I can perform some additional tests using widget classes. Could you provide sample code that you are using so that I can ensure I am mirroring your setup in my tests?

Thanks for the proposition.
Here is some code that you can use to test:

/** Type of chat */
UENUM(BlueprintType)
	enum class EChatType : uint8
{
	Message,
	Menu
};

UCLASS()
class UWidget_Chat : public UUserWidget
{
	GENERATED_UCLASS_BODY()

public:

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI")
		FText DisplayText;

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI")
		EChatType VisualChatType;

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI")
		TArray<TSubclassOf<ULocalMessage>> MenuMessages;
};

Thank you for providing the code. Using the code that you’ve shown above, the same method that I mentioned above works to allow the defaults to appear. Create a variable that is a reference to your Widget_Chat C++ class, or select Widget_Chat from the Class dropdown on the Get Class Defaults node, and you will be able to see the variables that you created in your code.

Have a great day

Hi,

I just tried again and I can’t get it worked. Are you using 4.10 or 4.11 to make this test?

thanks,

On my side, if I choose the C++ class it’s working, if I select a BP based on it, I have no value as the output.

thanks,

I just found that for the BP, I have to check the output on the Pin Options… so it’s working but not friendly ^^

Thanks,