How to undo/redo a modification to an array?

welp figures… obviously the community has no idea… will come back here when i discover the issue. Cheers!

almost done, i managed to create the array and use it with a custom FTableHelper constructor (as the TTransArray lacks a default constructor) but now i’m having issues with using the TransArray as a UPROPERTY: Unrecognized type ‘TTransArray’ - type must be a UCLASS, USTRUCT or UENUM

To support an Array transaction, one can do two things.

  1. Use TTransArray, but bear in mind, that because TTransArray doesn’t have a default constructor, one has to manually override the FVTableHelper constructor and any other that one could create.

    TTransArray<class MyData*> TransArray;

    MyContainerObject(FVTableHelper& Helper)
    : Super(Helper),
    TransArray(this) // and here you can initialize your members
    {
    }

Also, keep in mind, that TTransArray isn’t supported as a UPROPERTY, don’t know if that is intended, but seems that it’s a bug.

Finally, as posted on TTransArray doesn't work with transactions when using the "Insert" method, also it can't be used as a UPROPERTY - C++ - Unreal Engine Forums TTransArray doesn’t work when using Insert.

The other alternative is to use what’s defined on TTransArray and doing it manually. After any modification one must do:

if( GUndo )
		{
			GUndo->SaveArray( Owner, (FScriptArray*)this, Index, Count, 1, sizeof(T), DefaultConstructItem, SerializeItem, DestructItem );
		}

Hi guys, i’m creating a plugin but in it i’m needing to add, on a transaction, items to an array (or remove them).
AFAIK TArray doens’t support this.

It seems TTransArray is the way to go but i have 2 problems.

  1. It doesn’t let me use the array as an UPROPERTY (says it’s not a UCLASS)

  2. If i do use it, the array has no DefaultConstructor, so i cannot initialize it. even memberinitialization doesn’t work.

Any idea what to do? i could create a pointer and work on the stack instead of creating a reference, but i would better be using it as I use the arrays