// Use this for initialization void Start() { Object[] objects = FindObjectsOfType(typeof(Object)); foreach (Object o in objects) { //Debug.Log(o); /* * uncomment the line above to see all objects */ ObjectParent parent = o as ObjectParent; if (parent != null) { Debug.Log("FoundParent:" + parent); } } /* * Section 5.3.4.1 A Type is not an Object */ //FindObjectsOfType(Object); /* * Uncomment the line above to see the error. */ }
public void OnReadOnlyObject_ObjectIsSerialized() { ObjectParent parent = new ObjectParent(); parent.Item.Value = "TestValue"; Serializer s = new Serializer(typeof(ObjectParent)); string result = s.Serialize(parent); ObjectParent actual = (ObjectParent)s.Deserialize(result); Assert.AreEqual("TestValue", actual.Item.Value, "Readonly object value not set properly"); }