function 'FArchive &operator <<(FArchive &,AMainCharacter *&)' already has a body
I have followed this tutorial from Rama:
I want to override the operator << in a class (MainCharacter) to store a public Int32 value that AMainCharacter has, called TestIntValue;
With trial and error, I got it working, but I don't know what did I change that it doesn't work any more.
My code is simple:
SaveLoadLib.h Full code:
It doesn't compile. The error is:
**1>c:\unreal projects\MyProject\source\myproject\SaveLoadLib.h(8): error C2084: function 'FArchive &operator <<(FArchive &,AMainCharacter &)' already has a body*
1> c:\unreal projects\MyProject\source\myproject\Characters/MainCharacter.h(15): note: see previous definition of '<<'
I am more interested in understanding how this works than just getting it working or having a walkaround. I think I undestand the following points:
I want to serialize and save to disk some of the Actors and Structs that are in the Level.
Should I instead implement a function in the actors that I'm interested to save like:
Is there a better/more standardize way to do this? Is there any Design Patterns/Best Practice that I can follow? What happens with the private members of Unreal Class (Like AActor) that I'm extending from?
Just in case anybody is interested, this is how I solved it:
answered Nov 18 '15 at 03:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here