# How can I instantiate a UUserDefinedStruct a runtime ? 

**URL:** <https://forums.unrealengine.com/t/how-can-i-instantiate-a-uuserdefinedstruct-a-runtime/2746794>\
**Category:** Platform & Builds\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [July 22, 2026, 7:35am UTC](https://forums.unrealengine.com/t/how-can-i-instantiate-a-uuserdefinedstruct-a-runtime/2746794 "2026-07-22T07:35:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [July 22, 2026, 7:35am UTC](https://forums.unrealengine.com/t/how-can-i-instantiate-a-uuserdefinedstruct-a-runtime/2746794/1 "2026-07-22T07:35:41Z")

</div>

In our project we have a blueprint data asset, filled by designers, that defines some key, when modified it automatically generates a UUserDefinedStruct object that correspond to a struct having key names as member variables. This blueprint struct is then used to create chooser tables.

Chooser Table uses FStructView for that, which relies on a UScriptStruct\* and a memory address. I guess the UUserDefinedStruct should be passed as the script struct, but what about the memory address ?

I guess there is some kind of compilation for the UUserDefinedStruct that will provide a memoryblock similar to a classic FStruct and on which I can set values but I haven’t found how to do that, can you help me ?

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [July 22, 2026, 3:56pm UTC](https://forums.unrealengine.com/t/how-can-i-instantiate-a-uuserdefinedstruct-a-runtime/2746794/2 "2026-07-22T15:56:02Z")

</div>

I found the solution, which is using a FStructOnScope

Here is the code I ended up using (simplified), if that can help other people

```auto
EvaluateChooserTable(UUserDefinedStruct* ChooserTablesStruct, UChooserTable* ChooserTable)
 {
   FStructOnScope ChooserStructOnScope(ChooserTablesStructPtr); // will allow memory for a C++ style struct instance of the UUserDefinedStruct
   // loop on UUserDefinedStruct properties to fill our struct instance
   for (FProperty* Property : TFieldRange<FProperty>(ChooserTablesStruct))
   {
     // check property type and set value, in my case it was a game play tag, so the property is a struct property with a FGameplayTagContainer struct
     if (!ChooserStructProperty->IsA(FStructProperty::StaticClass()))
     {
       //unexpected
       continue;
     }
     FStructProperty* ChooserStructTypedProperty = CastFieldChecked<FStructProperty>(ChooserStructProperty);
     if (ChooserStructTypedProperty->Struct != FGameplayTagContainer::StaticStruct())
     {
       //unexpected
       continue;
     }
     FGameplayTagContainer* CurrentSlotGameplayTagContainer = ChooserStructTypedProperty->ContainerPtrToValuePtr<FGameplayTagContainer>(ChooserStructOnScope.GetStructMemory());
     CurrentSlotGameplayTagContainer->AddTag(MyTag);
   }
  
  // now evaluate the chooser table
   FChooserEvaluationContext EvaluationContext = UChooserFunctionLibrary::MakeChooserEvaluationContext();
   FStructView ChooserStructView(ChooserTablesStruct, ChooserStructOnScope.GetStructMemory());
   EvaluationContext.AddStructViewParam(ChooserStructView);
   const FInstancedStruct EvaluateChooserStruct = UChooserFunctionLibrary::MakeEvaluateChooser(ChooserTable.Get());
   UObject* ResultObject = UChooserFunctionLibrary::EvaluateObjectChooserBase(EvaluationContext, EvaluateChooserStruct, UObject::StaticClass());
 }

```

---

<div class="post-metadata">

**Author:** ![ZhiKangShao](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zhikangshao/32/1089997_2.png) [@ZhiKangShao](https://forums.unrealengine.com/u/ZhiKangShao)\
**Post date:** [July 28, 2026, 9:25am UTC](https://forums.unrealengine.com/t/how-can-i-instantiate-a-uuserdefinedstruct-a-runtime/2746794/3 "2026-07-28T09:25:21Z")

</div>

Thanks for letting us know you resolved it! And for sharing the snippet, I’m sure it will help others too.
