tranek / GASDocumentation

My understanding of Unreal Engine 5's GameplayAbilitySystem plugin with a simple multiplayer sample project.
MIT License
4.52k stars 819 forks source link

NetSerialize won't work for FNames #144

Open Juan-Ignacio-Tubio opened 2 weeks ago

Juan-Ignacio-Tubio commented 2 weeks ago

I'm working on Unreal Engine 5.3.2, Gameplay Abilities plugin version 1.0.

When creating a custom TargetData class in order to pass information through the event's handle, you can't use NetSerialize on FName variables. The compiler brings up an error saying that NetSerialize is not a member of FName.

What I have been able to do for my specific implementation is pass that data that would have been an FName as a string, and use SerializeAsANSICharArray() in order to serialize the data in that string and pass it in the handle.

// This is required for all child structs of FGameplayAbilityTargetData bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess) { MyFName.SerializeAsANSICharArray(Ar); bOutSuccess = true; return true; }