public static string Serialize(object obj) { if (obj == null) { return(null); } Type type = obj.GetType(); if (type.IsEnum) { return(BloxStringSerializer.GetData((int)obj)); } if (type.IsArray) { return(BloxStringSerializer.SerializeArray(obj)); } if (type.IsGenericType) { if (type.GetGenericTypeDefinition() == typeof(List <>)) { return(BloxStringSerializer.SerializeList(obj)); } return(null); } if (BloxStringSerializer.writers.ContainsKey(type)) { return(BloxStringSerializer.writers[type](obj)); } return(JsonUtility.ToJson(obj)); }