- Use a MakeArray Node with Structure pins
- “Split Struct Pin”
- “Remove array element pin”
- Newer pins added are either -1 or some other number
To prevent the bug at Step 4, you must “Recombine Struct Pin” before Step 3. Otherwise, once it happens you must delete the MakeArray node and start over.
I used a C++ class:
USTRUCT(BlueprintType)
struct FActorStateTransition
{
GENERATED_USTRUCT_BODY()
UPROPERTY(BlueprintReadWrite)
int32 State;
UPROPERTY(BlueprintReadWrite)
int32 OtherMember1;
UPROPERTY(BlueprintReadWrite)
int32 OtherMember2;
};
UCLASS(Blueprintable)
class CELESTIAL_API UActorStates : public UObject
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, Category=States)
void AddStates(TArray<FActorState> States) {}
};
And then to reproduce the bug:
- Parent a Blueprint class to ActorStates
- Create the “AddStates” function node (Right-click Graph → States → Add States)
- Drag out the “States” input and “Make Array”
- Right-click on [0] and “Split Struct Pin”
- Right-click on the top [0] member and “Remove array element from pin”
- The other members are still there (which shouldn’t be)
- Newer pins (“Add Pin”) added are either -1 or some other number