# Can FFastNetArraySerializer be nested another USTRUCT?

**URL:** <https://forums.unrealengine.com/t/can-ffastnetarrayserializer-be-nested-another-ustruct/148852>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [August 8, 2020, 1:48am UTC](https://forums.unrealengine.com/t/can-ffastnetarrayserializer-be-nested-another-ustruct/148852 "2020-08-08T01:48:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_00c7dad7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_00c7dad7](https://forums.unrealengine.com/u/anonymous_user_00c7dad7)\
**Post date:** [August 8, 2020, 1:48am UTC](https://forums.unrealengine.com/t/can-ffastnetarrayserializer-be-nested-another-ustruct/148852/1 "2020-08-08T01:48:08Z")

</div>

I wonder if this is possible, that it works as I expected.

```auto

USTRUCT()
struct FGameItemInstanceNetArrayArg : public FFastArraySerializerItem
{
    UPROPERTY()
    TSubclassOf<UItem> ItemClass;
    UPROPERTY()
    int32 InventorySlotId;
    UPROPERTY()
    TArray<uint8> RawItemTraits;
...
};

struct FGameItemInstanceNetArray : public FFastArraySerializer

```

However, an argument class FGameItemInstanceNetArrayArg can be pretty complex since it can hold an item’s unique traits; creator, color, durability, etc …

For now, I manage those traits as ‘ItemTrait’ class, which derives UObject class, which cannot be replicated as is. Thus when It needs to be serialized to the client, it firstly serialized into TArray, and replicated. Of course, as you see, those are extremely inefficient. Even a single change of a trait element causes re-serialization and replication of whole byte array. And I cannot make trait class as concrete USTRUCT, because there will be lots of variance of item traits.

Therefore I’m planning to change item traits into the map of key-byte chunks, like below.

```auto

USTRUCT()
struct FGameItemTraitArg : public FFastArraySerializerItem
{
   UPROPERTY()
   uint32 KeyHash; // Will get from GetTypeHash() function
   UPROPERTY()
   uint8 Chunk[28]; // Can hold any item ... maximum of 28 bytes of data ...  
};

USTRUCT()
struct FGameItemTraitNetMap : public FFastArraySerializer
{ ... } // Uses FGameItemTraitArg as serializer item ...

USTRUCT()
struct FGameItemInstanceNetArrayArg : public FFastArraySerializerItem
{
    UPROPERTY()
    TSubclassOf<UItem> ItemClass;
    UPROPERTY()
    int32 InventorySlotId;
    UPROPERTY()
    FGameItemTraitNetMap Traits;
;
...
}

```

I wonder if this is possible, that it works as I expected; optimizes array serialization like working as UCLASS’s property

---

<div class="post-metadata">

**Author:** ![BoozelsGoodFood](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BoozelsGoodFood](https://forums.unrealengine.com/u/BoozelsGoodFood)\
**Post date:** [June 22, 2022, 4:36pm UTC](https://forums.unrealengine.com/t/can-ffastnetarrayserializer-be-nested-another-ustruct/148852/2 "2022-06-22T16:36:27Z")

</div>

@anonymous_user_00c7dad7

Did you manage to get a solution for this? I have a similar problem in terms of how should I nest arrays for fast serialization.

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [June 22, 2022, 8:52pm UTC](https://forums.unrealengine.com/t/can-ffastnetarrayserializer-be-nested-another-ustruct/148852/3 "2022-06-22T20:52:14Z")

</div>

To answer the original question, no they cannot be nested.
