selector.AddSurrogate(typeof(Vector3), new StreamingContext(StreamingContextStates.All), vector3Surrogate);
the last part, “vector3Surrogate” is marked as an error saying, “cannot convert from ‘Vector3SerrializationSurrogate’ to ‘System.Runtime.Serialization.ISerializationSurrogate.’”
Does anybody know what the problem could be? I am totally new to Serialization so it could be something fairly basic.
Here is the video tutorial I am following if it helps.
Well your “Vector3SerrializationSurrogate” class most likely does not implement the “ISerializationSurrogate” interface as shown in the tutorial. Since you provided none of your own code in your question we can not really answer your issue. In the video the surrogate class does implement that interface and your error clearly shows your class doesn’t. Maybe you didn’t save your files properly?
Please, when following tutorials you should try to actually understand the code that is shown. Don’t just blindly copy whatever they show you. Tutorials are meant to teach concepts.
You were right. My classes just got a bit jumbled. Thank you for the answer.
And as for the blindly copying, Like I said before, I am new to serialization. There is simply too much for me to try to understand before writing it down. The guy in the video knows his stuff, So I copy him, but I listen to his explanations, trying to understand what everything does. Then I try to adjust the code to work within my own game. That usually leaves me with at least a basic understanding of what is going on. It’s tough for me to learn new code without writing it and testing it out for myself.
I also didn’t show any code because I was not sure at the time where exactly the problem was. I was just looking for a general direction, which you provided. Thanks again 