public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { SerializedCamera sC = JsonConvert.DeserializeObject <SerializedCamera>(JToken.Load(reader).ToString()); GameObject go = GameObject.Find(sC.objectName); if (go != null) { Camera camera = go.GetComponent <Camera>(); return(camera); } return(null); }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { SerializedCamera sq = new SerializedCamera((Camera)value); JToken.FromObject(JsonConvert.SerializeObject(sq)).WriteTo(writer); }