So I have created UStruct in BT_TaskNode Like that :
USTRUCT(BlueprintType)
struct FSAnswerText
{
GENERATED_BODY()
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "FSAnswerText")
FText FTAnswerText;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "FSAnswerText")
float DelayTime;
};
I want to make visible this UStructure and variables in details panel to change its default values but no matter what I do its still blank so what should I do to make it work?
Add “EditAnywhere” to the UPROPERTY(…, EditAnywhere, …) and it should show them.
I have tried “EditAnywhere” too but its not workin
Do you also use this Tags in the definition of the struct variable itself like:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FAnswerType Whatever;
and is this variable public?
USTRUCT(BlueprintType)
struct FSAnswerText
{
GENERATED_BODY()
public :
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FText FTAnswerText;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
float DelayTime;
};
Do you mean something like this?
even this have no effect at all
No not that you have somewhere inside a class (probably) a variable of that type in order to use the struct thats the part we need to edit i assume.
Yep i think i have to decleare this struct inside of UClass but VS throws me compilation error no matter what I do, currently my code looks like this
Have you ever done something like this by yourself?
IanVL
(IanVL)
August 9, 2017, 4:25pm
8
Just make the USTRUCT in a different .h file and include that one into the class that uses the struct.
And put inside the class as a member variable:
UPROPERTY(EditAnywhere, blueprintReadWrite, Category = “FSAnswerText”)
FSAnswerText myStructVariable;
Now you can set the struct defaults in the Blueprint/c++ of your class.
For me this always works perfectly fine I expose structs very often I would try remove the public in the struct (this solves the compiler error). But to expose it in the editor you need DECLARE a viriable of “FAnswerText”! Add
UPOROPERTY(EditAnywhere)
FText AnswerText;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Whatever")
FAnswerText AnswerText;
JeFrYx
(JeFrYx)
September 28, 2017, 3:33pm
10
Structures are not allowed to be initialized without initializing all of its members. You have to add a constructor like this.
USTRUCT(BlueprintType)
struct FSAnswerText
{
GENERATED_BODY()
public :
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FText FTAnswerText;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
float DelayTime;
FSAnswerText() : FTAnswerText (DEFAULT_VALUE), DelayTime(DEFAULT_VALUE)
{
}
};
Remember to add the DEFAULT_VALUES, it´s just a placeholder for the answer.
Hope it helps.
I am having this problem and adding a constructor that sets all struct members to a default value has not changed the behaviour.