Create an Array with C++

Sorry if this is super basic, I’m a Unity user transitioning to UE5.

I want to create an empty object and use UE5 C++ to allow users to put the Instance objects in the Outliner into the array of empty object (the array is as shown in the picture below), but I don’t know how to implement that. Can anyone help me?
image

1 Like

Use Tarray.
Example: const TArray<float> FloatArray = TArray<float> { 0.1f, 0.2f, 0.2f, 0.3f };
If you want to be able to access it in the blueprint, use this

UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Components")
const TArray<float> FloatArray:

Then in constructor:

FloatArray = TArray<float> { 0.1f, 0.2f, 0.2f, 0.3f };

Docs: TArray: Arrays in Unreal Engine | Unreal Engine Documentation

4 Likes