TeamSirenix / odin-serializer

Fast, robust, powerful and extendible .NET serializer built for Unity

Home Page:http://www.odininspector.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deserialize to type that is only known at runtime (instead of compile type generic) like unity's JsonUtility

kyle-v opened this issue · comments

Hello, apologies if this is answered before:

I am looking to serialize and deserialize types where the type is not a compile time constant that can be using in a generic like <T>

In unity I can do this with JSON using this method overload:

var payloadType = Type.GetType(serializedSaveState.payloadType);
var saveStateData = JsonUtility.FromJson(serializedSaveState.payload, payloadType);

With Odin would it be possible to make a similar overload that takes in a Type instead of a generic method? Preferably for both Binary and Json formats.