@@ -10,6 +10,11 @@ namespace Toolbox.Editor
1010{
1111 public static partial class PropertyUtility
1212 {
13+ //TODO: temp
14+ private static readonly MethodInfo getGetFieldInfoFromPropertyMethod =
15+ ReflectionUtility . GetEditorMethod ( "UnityEditor.ScriptAttributeUtility" , "GetFieldInfoFromProperty" ,
16+ BindingFlags . NonPublic | BindingFlags . Static ) ;
17+
1318 /// <summary>
1419 /// Indicates if the property has all changes applied and can be safely used for reflection-based features.
1520 /// </summary>
@@ -257,7 +262,13 @@ public static FieldInfo GetFieldInfo(this SerializedProperty property)
257262
258263 public static FieldInfo GetFieldInfo ( this SerializedProperty property , out Type propertyType )
259264 {
260- return GetFieldInfoFromProperty ( property , out propertyType ) ;
265+ var parameters = new object [ ] { property , null } ;
266+ var result = getGetFieldInfoFromPropertyMethod . Invoke ( null , parameters ) as FieldInfo ;
267+ propertyType = parameters [ 1 ] as Type ;
268+ return result ;
269+
270+ //NOTE: ...
271+ //return GetFieldInfoFromProperty(property, out propertyType);
261272 }
262273
263274 public static FieldInfo GetFieldInfo ( this SerializedProperty property , out Type propertyType , Object target )
@@ -277,8 +288,12 @@ public static FieldInfo GetFieldInfoFromProperty(SerializedProperty property, ou
277288 return GetFieldInfoFromProperty ( property , out type , classType ) ;
278289 }
279290
291+ //NOTE: ...
292+ //TODO: make it internal
280293 public static FieldInfo GetFieldInfoFromProperty ( SerializedProperty property , out Type type , Type host )
281294 {
295+ const BindingFlags fieldFlags = BindingFlags . Instance | BindingFlags . Public | BindingFlags . NonPublic ;
296+
282297 FieldInfo field = null ;
283298 type = host ;
284299
@@ -297,7 +312,6 @@ public static FieldInfo GetFieldInfoFromProperty(SerializedProperty property, ou
297312 continue ;
298313 }
299314
300- const BindingFlags fieldFlags = BindingFlags . Instance | BindingFlags . Public | BindingFlags . NonPublic ;
301315 FieldInfo foundField = null ;
302316 for ( var currentType = type ; foundField == null && currentType != null ; currentType = currentType . BaseType )
303317 {
0 commit comments