/// <summary> /// Serializes the given object and stores it into this SerializableObject /// </summary> protected virtual void Serialize() { if (isNullObject = Object == null) { return; } unityObject = null; serializedSystemObject = String.Empty; objectType = new SerializableType(Object.GetType()); if (typeof(UnityEngine.Object).IsAssignableFrom(Object.GetType())) { unityObject = (UnityEngine.Object)Object; } else if (Object.GetType().IsSerializable) { serializedSystemObject = SerializeToString <System.Object> (Object); } // else default object (and even serializable members) will be restored from the type }