//プロパティの値をバイナリ読み込み void ReadPropertyValue(SerializedProperty property, BinaryReader reader) { property = property.Copy(); switch (property.propertyType) { case SerializedPropertyType.Integer: case SerializedPropertyType.Character: case SerializedPropertyType.LayerMask: case SerializedPropertyType.Enum: property.intValue = reader.ReadInt32(); break; case SerializedPropertyType.Boolean: property.boolValue = reader.ReadBoolean(); break; case SerializedPropertyType.Float: property.floatValue = reader.ReadSingle(); break; case SerializedPropertyType.String: property.stringValue = reader.ReadString(); break; case SerializedPropertyType.ArraySize: property.arraySize = reader.ReadInt32(); break; case SerializedPropertyType.Color: property.colorValue = BinaryUtil.ReadColor(reader); break; case SerializedPropertyType.Vector2: property.vector2Value = BinaryUtil.ReadVector2(reader); break; case SerializedPropertyType.Vector3: property.vector3Value = BinaryUtil.ReadVector3(reader); break; case SerializedPropertyType.Vector4: property.vector4Value = BinaryUtil.ReadVector3(reader); break; case SerializedPropertyType.Rect: property.rectValue = BinaryUtil.ReadRect(reader); break; case SerializedPropertyType.Bounds: property.boundsValue = BinaryUtil.ReadBounds(reader); break; case SerializedPropertyType.Quaternion: property.quaternionValue = BinaryUtil.ReadQuaternion(reader); break; case SerializedPropertyType.ObjectReference: property.objectReferenceValue = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(reader.ReadString()), typeof(UnityEngine.Object)); break; case SerializedPropertyType.Generic: ReadGenericPropertyValue(property, reader); break; case SerializedPropertyType.AnimationCurve: case SerializedPropertyType.Gradient: default: Debug.LogError("Read Not Support Property :" + property.name + ":" + property.propertyType.ToString()); break; } }