示例#1
0
        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);
        }
示例#2
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            SerializedCamera sq = new SerializedCamera((Camera)value);

            JToken.FromObject(JsonConvert.SerializeObject(sq)).WriteTo(writer);
        }