Hello UE4 C++/Blueprints Gurus,
We're seeking C++ / Blueprints recommendations To Add Items To Array Variable in Editor From Blueprints ConstructionScript? Vice Versa.
The goal is to Add Array Items and programmatically data-fill from BP ConstructionScript, displayed in the Editor Details Panel for Manual Editing at design-time. Vice Versa.
Thank you for reading our post. All support in this matter is greatly appreciated.
Hello there @TheGameDevStore could you elaborate more on exactly what it is you want to achieve? You can dynamically build the individual items using a “Make” node for their type. The screenshot below shows some simple examples for adding items to an array from blueprint.
Sadly the items you add to an Array in the blueprint constructor won’t show up in the details panel. However if you add them in your C++ constructor they will. Alternatively you could also get and edit the array elements individually by index using the OnBeginPlay Event in your blueprint graph, so you can set them up there instead of in the details panel, but of course they’ll only be applied when the level loads.
We truly appreciate you taking time to respond. The intent is to dynamic build the Array List of Structures (12 members) from Mesh Skeleton at design time using the ConstructionScript, and modify parameters (if needed) from the Editor’s Detail Panel (GUI). Dynamic generation is desired as Skeletal Mesh can be changed and vary in number of bones.
With consideration to the statement: *Sadly the items you add to an Array in the blueprint constructor won’t show up in the details panel. However if you add them in your C++ constructor they will. *We will attempt to dynamically generate from C++ Constructor.
You’re very welcome. I’ve written a quick example for you, hope it’s of some use.
USTRUCT(BlueprintType) // We use the BlueprintType Tag to allow us to use this struct in BP
/* The EditAnywhere tag allows us to change this variable in the details panel.
* BlueprintReadWrite just allows us to work with this variable in the Blueprint Graph */
/* Default Struct Constructor */
MyFloat = 0.0f;
MyInteger = 0;
/* Regular Struct Constructor */
FMyStruct(const float InFloat, const int InInt)
MyFloat = InFloat;
MyInteger = InInt;
/* Blueprintable allows us to create Blueprint classes dervived from this one */
class EDITORWORKSPACE_API UMyObject : public UObject
/* Class constructor */
/* Here's our TArray of our struct type */
The two items added in the C++ constructor being displayed in the Details panel, with their set values.