cant create array of pointers

MyStruct Var1;
MyStruct Var2;
MyStruct Var3;
TArray<MyStruct*> MyArray;

void MyClass::AddPointerToArray()

**.h(394) : Error: Inappropriate '’ on variable of type ‘MyStruct’, cannot have an exposed pointer to this type.

same with

MyStruct* MyArray] = {&Var1, &Var2, &Var3};

Would need to see the definition of “MyStruct” to be sure, but is your data a UClass or UStruct as base? (I’m thinking UStruct.) If so, better off passing by value rather than pointers (more here: Making an array of Structs a UProperty - UE4 AnswerHub)

If you want to pass your custom struct as a reference instead of only copy value, inside your struct you must declare a proper GetHashType(const MyStruct&) and declare all the boolean operators needed for type miss/matching as well.

Then you can do FMyStruct* myStruct;

Also, you can’t use TArray with native types. It should be a UStruct; UStructs always begin with a ‘F’ prefix.

You can use a TArray with native types if you wrap those into a smart pointer aka TSharedPtr

Yes, but I guess his TArray is UProperty() too. In this case it simply can’t be a pointer because UBT will throw exception if he use struct pointer as UProperty.

Yep no prop for non-UE types, to fix that I just create an UObject/UStruct wrapper and serialize what I need ^^. That would also work for his case.

Thanks alot.