@@ -15,7 +15,8 @@ public static class PropertyFinder
1515 /// <summary>
1616 /// List of types to exclude from the types of components in the UI we can bind to.
1717 /// </summary>
18- private static readonly HashSet < Type > hiddenTypes = new HashSet < Type > {
18+ private static readonly HashSet < Type > hiddenTypes = new HashSet < Type >
19+ {
1920 typeof ( AbstractMemberBinding ) ,
2021 typeof ( OneWayPropertyBinding ) ,
2122 typeof ( TwoWayPropertyBinding )
@@ -24,24 +25,31 @@ public static class PropertyFinder
2425 /// <summary>
2526 /// Use reflection to find all components with properties we can bind to.
2627 /// </summary>
27- public static IEnumerable < BindableMember < PropertyInfo > > GetBindableProperties ( GameObject gameObject ) //todo: Maybe move this to the TypeResolver.
28+ public static BindableMember < PropertyInfo > [ ] GetBindableProperties ( GameObject gameObject ) //todo: Maybe move this to the TypeResolver.
2829 {
30+ BindableMember < PropertyInfo > [ ] bindableProperties ;
2931 using ( var cache = gameObject . GetComponentsWithCache < Component > ( ) )
3032 {
31- return cache . Components
32- . SelectMany ( component =>
33- {
34- var type = component . GetType ( ) ;
35- return type
36- . GetProperties ( BindingFlags . Instance | BindingFlags . Public )
37- . Select ( p => new BindableMember < PropertyInfo > ( p , type ) ) ;
38- } )
39- . Where ( prop => prop . Member . GetSetMethod ( false ) != null
40- && prop . Member . GetGetMethod ( false ) != null
41- && ! hiddenTypes . Contains ( prop . ViewModelType )
42- && ! prop . Member . GetCustomAttributes ( typeof ( ObsoleteAttribute ) , true ) . Any ( )
43- ) ;
33+ bindableProperties = cache . Components
34+ . SelectMany ( component =>
35+ {
36+ var type = component . GetType ( ) ;
37+ return type
38+ . GetProperties ( BindingFlags . Instance | BindingFlags . Public )
39+ . Select ( p => new BindableMember < PropertyInfo > ( p , type ) ) ;
40+ } )
41+ . Where ( prop => prop . Member . GetSetMethod ( false ) != null
42+ && prop . Member . GetGetMethod ( false ) != null
43+ && ! hiddenTypes . Contains ( prop . ViewModelType )
44+ && ! prop . Member
45+ . GetCustomAttributes ( typeof ( ObsoleteAttribute ) , true )
46+ . Any ( )
47+ ) . OrderBy ( prop => prop . ViewModelTypeName )
48+ . ThenBy ( prop => prop . MemberName )
49+ . ToArray ( ) ;
4450 }
51+
52+ return bindableProperties ;
4553 }
4654 }
47- }
55+ }
0 commit comments