Non-generic Read methods for ES3Types

Vote for new features, or make your own requests here.
Post Reply

Non-generic Read methods for ES3Types

Yes, I would like this feature
0
No votes
No, I would not like this feature
0
No votes
 
Total votes: 0

User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Non-generic Read methods for ES3Types

Post by Joel »

Status

Requested

Complexity

6/10

Description

Sometimes it is necessary to to get a field via reflection within an ES3Type (e.g. when working with internal classes from outside of their assembly).

Anecdote from Falondrian in the Unity thread:
6. ES3Reader provides the following function
Code (CSharp):
public virtual T Read<T>()
{
return Read<T>(ES3TypeMgr.GetOrCreateES3Type(typeof(T)));
}
I would like to have a non-generic version. When serializing internal classes their Type has to be acquired via reflection so a generic method cannot be used.
Code (CSharp):
public virtual object Read(Type type)
{
return Read(ES3TypeMgr.GetOrCreateES3Type(type));
}

reader.SetPrivateField("m_ID", reader.Read(Type.GetType("OtherAssembly.SomeInternalIDClass")), instance);
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply