Pinpointing the bad call in a "SerializationException"

I’m not sure of that… when it hits this one the exception throws it out of considering any more fields / properties, making it appear like there’s only one issue.

It sounds like perhaps this codebase relied on BinaryFormatter being able to serialize these ScriptableObjects and pull what it needed out (in a past version of C# / Unity).

That is of course assuming that it worked at all and simply wasn’t silently broken all this time to begin with, as in these fields weren’t just MIA all this time. :slight_smile:

Pick any one ScriptableObject, make a class containing a reference to it, drag a reference in, and using this same codepath, try and serialize that and see if you get the same exception first.

It’s also possible that it is actually blowing up because a ScriptableObject field is null, and mis-reporting it as “not marked as serializable.”

You could also point a good JSON serializer (like NewtonSoft) at the same data struct and see what it thinks. If it blows up, the error might be more useful, or even other errors might give you intel.

Here was my workaround: Loading/Saving ScriptableObjects by a proxy identifier such as name:

1 Like