public override void WriteJson(JsonWriter w, object o, JsonSerializer szr)
        {
            var settings      = JsonBlueprints.CreateSettings(null);
            var newSerializer = JsonSerializer.Create(settings);
            var j             = new JObject();

            j.AddFirst(new JProperty("$type", JsonBlueprints.GetTypeName(o.GetType())));
            foreach (var field in JsonBlueprints.GetUnitySerializableMembers(o.GetType()))
            {
                var value = Traverse.Create(o).Field(field.Name).GetValue();
                j.Add(field.Name, value != null ? JToken.FromObject(value, newSerializer) : null);
            }
            j.WriteTo(w);
        }
        public override void WriteJson(JsonWriter w, object o, JsonSerializer szr)
        {
            var settings      = JsonBlueprints.CreateSettings(null);
            var newSerializer = JsonSerializer.Create(settings);
            var j             = new JObject();

            j.AddFirst(new JProperty("$type", JsonBlueprints.GetTypeName(o.GetType())));
            foreach (var memberInfo in JsonBlueprints.GetUnitySerializableMembers(o.GetType()))
            {
                object value = null;
                if (memberInfo.MemberType == MemberTypes.Field)
                {
                    value = ((FieldInfo)memberInfo).GetValue(o);
                }
                else if (memberInfo.MemberType == MemberTypes.Property)
                {
                    value = ((PropertyInfo)memberInfo).GetValue(o);
                }
                j.Add(memberInfo.Name, value != null ? JToken.FromObject(value, newSerializer) : null);
            }
            j.WriteTo(w);
        }
 protected override List <MemberInfo> GetSerializableMembers(Type objectType)
 {
     return(JsonBlueprints.GetUnitySerializableMembers(objectType).Distinct().ToList());
 }
 List <MemberInfo> GetSerializableMembers(Type objectType)
 {
     return(JsonBlueprints.GetUnitySerializableMembers(objectType));
 }