Reputation: 157
I'm trying to successfully decompile and update an old unity game I have, I've fixed most of the errors, but this one is still giving me grief. All the documentation I can find tells me to assign to the member directly, but that isn't an option, as the member set_SurrogateSelector acesses an internal member, m_surrogates.
private static void Init()
{
UnityLogWriter.Init();
if (Application.platform.ToString().Contains("WebPlayer"))
{
BinaryFormatter.set_SurrogateSelector(new UnitySurrogateSelector());
}
}
// Decompiled BinaryFormatter
...
internal ISurrogateSelector m_surrogates;
public void set_SurrogateSelector(ISurrogateSelector value)
{
this.m_surrogates = value;
}
And so, how can I set the surrogate selector? Or do I have to compile a custom mscorlib.dll as well?
EDIT: Updated code, same error
BinaryFormatter nBFormatter = new BinaryFormatter();
UnityLogWriter.Init();
if (Application.platform.ToString().Contains("WebPlayer"))
{
nBFormatter.SurrogateSelector = new UnitySurrogateSelector();
}
Upvotes: 1
Views: 285
Reputation: 117220
That's not true. BinaryFormatter.SurrogateSelector
is public.
But you seem to use it wrong.
It is an instance property, and thus needs an instance.
Upvotes: 1
Reputation: 887315
That's a property.
BinaryFormatter.SurrogateSelector = new UnitySurrogateSelector();
Upvotes: 1