Failing to copy/paste a TArray UPROPERTY?

Scylardor4242
Wed, 06 May 2020 02:00:01 +0000
C++

Hi,

I’m having an issue with a TArray property.

I was inspired by the AI Perception Component to create a configuration property for my actors that would be an array of pointers to a UObject base class. In the editor, the user is then able to select a configuration in the dropdown list between all the child classes of this base class. It works great !

But when I try to copy/paste this array to another actor (especially in another level), all the pointers become None.

I wonder if this is an engine bug or if I’m doing something wrong.

My property looks like that :

UPROPERTY(BlueprintReadWrite, EditAnywhere, Instanced, Category = MetaFSM, meta = (AllowPrivateAccess = "true"))
TArray<UBaseStateDescriptor*> StatesArray;

and my base class is declared like that :

UCLASS(Blueprintable, DefaultToInstanced, collapsecategories, hidecategories = Object, editinlinenew, abstract)
class XAO_API UBaseStateDescriptor : public UObject

technically it makes sense for Unreal not to copy pointer data and so it sets everything back to null. I’d just like it to make a deep copy, but I don’t know if I’m missing a parameter somewhere or anything.

I thought that “Instanced” would be the answer to my problem but it doesn’t fix it.

Any help will be appreciated !

1 post - 1 participant