Skip to content

Commit aa91397

Browse files
committed
fix: 使用属性代理访问string类型失效的问题
1 parent fc2b74a commit aa91397

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

Assets/Scripts/SerializeExtension/Editor/SerializeExtensionDrawer.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
3838
}
3939

4040
bool hasValueUpdated = EditorGUI.EndChangeCheck() || !attribute.CanWrite; // !attribute.CanWrite : 当变量不可写时大概率用作显示某个字段的成员信息,为了避免字段发生修改时成员信息更新不同步的问题需要保持更新才行
41-
bool canSerializeType = typeof(UnityEngine.Object).IsAssignableFrom(fieldType) || fieldType.IsValueType;
42-
if (hasValueUpdated && canSerializeType && attribute.ProxyPropertyName != null) {
41+
if (hasValueUpdated && attribute.ProxyPropertyName != null) {
4342
var owner = GetFieldOwner(property);
4443
PropertyInfo proxy = owner.GetType().GetProperty(attribute.ProxyPropertyName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); ;
4544
if (CheckPropertyProxyValid(proxy, owner, fieldType)) {
@@ -139,20 +138,6 @@ private object CreateInstance(Type type) {
139138
return FormatterServices.GetSafeUninitializedObject(type);
140139
}
141140

142-
//private Type GetRuntimeType(SerializedProperty property) {
143-
// Type fieldType = fieldInfo.FieldType;
144-
// bool canSerializeType = typeof(UnityEngine.Object).IsAssignableFrom(fieldType) || fieldType.IsValueType;
145-
// if (canSerializeType || property.propertyType != SerializedPropertyType.ManagedReference) {
146-
// return fieldInfo.FieldType;
147-
// }
148-
// else {
149-
// string[] info = property.managedReferenceFieldTypename.Split();
150-
// string asseblyName = info[0], typeName = info[1];
151-
// Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(item => item.GetName().Name == asseblyName);
152-
// return assembly.GetType(typeName);
153-
// }
154-
//}
155-
156141
#endregion
157142

158143
private object GetFieldOwner(SerializedProperty property) {

0 commit comments

Comments
 (0)