# UE 4.5.1 Saving Loading Custom USTRUCT()

**URL:** <https://forums.unrealengine.com/t/ue-4-5-1-saving-loading-custom-ustruct/298098>\
**Category:** Editor Scripting\
**Tags:** ustruct, unreal-engine, CPP, question\
**Created:** [November 4, 2014, 6:37am UTC](https://forums.unrealengine.com/t/ue-4-5-1-saving-loading-custom-ustruct/298098 "2014-11-04T06:37:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ErraOfWar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ErraOfWar](https://forums.unrealengine.com/u/ErraOfWar)\
**Post date:** [November 4, 2014, 6:37am UTC](https://forums.unrealengine.com/t/ue-4-5-1-saving-loading-custom-ustruct/298098/1 "2014-11-04T06:37:23Z")

</div>

I am currently making a login/registering system for my game and i am following along with Rama’s “Custom Save Systems, Write Any Data to Compressed Binary Files”. I am was wondering if it was possible and how if i can save my own custom UStruct to a compressed Binary File.

So far i have gotten most of the logic down, but i am getting an error here:

```
void AMyGameMode::SaveLoadData(FArchive& Ar, TArray<FPlayerRegisterInfo>& SaveDataArray)
{
	Ar << SaveDataArray;
}

```

“binary ‘\<\<’ : no operator found which takes a right-hand operand of type ‘FPlayerRegisterInfo’ (or there is no acceptable conversion)”

I’m good with logic, but i’m still trying to get used to UE’s variable conversions. Anyone know any solutions?

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [November 4, 2014, 8:55am UTC](https://forums.unrealengine.com/t/ue-4-5-1-saving-loading-custom-ustruct/298098/2 "2014-11-04T08:55:14Z")

</div>

#Define \<\< Operator for Your UStruct

You need to define the \<\< operator for your custom UStruct!

Put this in a .h file where you define your core types, use your custom struct FPlayerRegisterInfo and all its members

#Solus Example

```
FORCEINLINE FArchive &operator <<(FArchive &Ar, FSolusApexDamage& TheStruct )
{
	Ar << TheStruct.Name;
	Ar << TheStruct.DamageAmount;
	Ar << TheStruct.HitLocation;
	Ar << TheStruct.ImpulseDir;
	Ar << TheStruct.ImpulseStrength;
	
	return Ar;
}

```

Enjoy!

Rama

---

<div class="post-metadata">

**Author:** ![ErraOfWar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ErraOfWar](https://forums.unrealengine.com/u/ErraOfWar)\
**Post date:** [November 5, 2014, 9:25am UTC](https://forums.unrealengine.com/t/ue-4-5-1-saving-loading-custom-ustruct/298098/3 "2014-11-05T09:25:22Z")

</div>

Rama to the rescue. Thanks works perfectly now :).

---

<div class="post-metadata">

**Author:** ![pyskonus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pyskonus/32/485279_2.png) [@pyskonus](https://forums.unrealengine.com/u/pyskonus)\
**Post date:** [October 29, 2022, 4:45pm UTC](https://forums.unrealengine.com/t/ue-4-5-1-saving-loading-custom-ustruct/298098/4 "2022-10-29T16:45:03Z")

</div>

Idk if it sounds obvious, but I’d like to point out things that still took me some time to figure out

1. the \<\< operator should be a friend function
2. if you are saving a TArray of ustructs, their properties must be marked with UPROPERTY.
