# Make usable UStruct in details panel

**URL:** <https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418>\
**Category:** C++\
**Tags:** Struct, details-panel-ui, unreal-engine, CPP, question\
**Created:** [August 8, 2017, 1:04pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418 "2017-08-08T13:04:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_05126ce8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_05126ce8](https://forums.unrealengine.com/u/anonymous_user_05126ce8)\
**Post date:** [August 8, 2017, 1:04pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/1 "2017-08-08T13:04:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e93164e4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e93164e4](https://forums.unrealengine.com/u/anonymous_user_e93164e4)\
**Post date:** [August 8, 2017, 1:31pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/2 "2017-08-08T13:31:34Z")

</div>

Add “EditAnywhere” to the UPROPERTY(…, EditAnywhere, …) and it should show them.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_05126ce8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_05126ce8](https://forums.unrealengine.com/u/anonymous_user_05126ce8)\
**Post date:** [August 8, 2017, 1:43pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/3 "2017-08-08T13:43:26Z")

</div>

I have tried “EditAnywhere” too but its not workin ☹

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e93164e4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e93164e4](https://forums.unrealengine.com/u/anonymous_user_e93164e4)\
**Post date:** [August 8, 2017, 1:57pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/4 "2017-08-08T13:57:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_05126ce8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_05126ce8](https://forums.unrealengine.com/u/anonymous_user_05126ce8)\
**Post date:** [August 8, 2017, 3:22pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/5 "2017-08-08T15:22:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e93164e4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e93164e4](https://forums.unrealengine.com/u/anonymous_user_e93164e4)\
**Post date:** [August 8, 2017, 7:12pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/6 "2017-08-08T19:12:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_05126ce8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_05126ce8](https://forums.unrealengine.com/u/anonymous_user_05126ce8)\
**Post date:** [August 9, 2017, 9:57am UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/7 "2017-08-09T09:57:10Z")

</div>

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

 ![203957-screenshot_1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/2/4229edac248aa546948fa571cc046d616a70dcc0.png)

Have you ever done something like this by yourself?

---

<div class="post-metadata">

**Author:** ![IanVL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IanVL](https://forums.unrealengine.com/u/IanVL)\
**Post date:** [August 9, 2017, 4:25pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/8 "2017-08-09T16:25:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e93164e4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e93164e4](https://forums.unrealengine.com/u/anonymous_user_e93164e4)\
**Post date:** [August 18, 2017, 6:15pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/9 "2017-08-18T18:15:36Z")

</div>

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;

```

---

<div class="post-metadata">

**Author:** ![JeFrYx](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jefryx/32/881300_2.png) [@JeFrYx](https://forums.unrealengine.com/u/JeFrYx)\
**Post date:** [September 28, 2017, 3:33pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/10 "2017-09-28T15:33:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AlexMayTCR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlexMayTCR](https://forums.unrealengine.com/u/AlexMayTCR)\
**Post date:** [August 2, 2021, 8:24pm UTC](https://forums.unrealengine.com/t/make-usable-ustruct-in-details-panel/398418/11 "2021-08-02T20:24:33Z")

</div>

I am having this problem and adding a constructor that sets all struct members to a default value has not changed the behaviour.
