File tree Expand file tree Collapse file tree
Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#if UNITY_2019_3_OR_NEWER
22using System ;
3+ using System . Collections . Generic ;
34using System . Reflection ;
45using UnityEditor ;
56using UnityEngine ;
67
78namespace MackySoft . SerializeReferenceExtensions . Editor {
89 public static class ManagedReferenceUtility {
910
11+ public static IEnumerable < SerializedProperty > GetChildProperties ( this SerializedProperty parent , int depth = 1 )
12+ {
13+ parent = parent . Copy ( ) ;
14+
15+ int depthOfParent = parent . depth ;
16+ var enumerator = parent . GetEnumerator ( ) ;
17+
18+ while ( enumerator . MoveNext ( ) )
19+ {
20+ if ( enumerator . Current is not SerializedProperty childProperty )
21+ {
22+ continue ;
23+ }
24+ if ( childProperty . depth > ( depthOfParent + depth ) )
25+ {
26+ continue ;
27+ }
28+ yield return childProperty . Copy ( ) ;
29+ }
30+ }
31+
1032 public static object SetManagedReference ( this SerializedProperty property , Type type ) {
1133 object result = null ;
1234
You can’t perform that action at this time.
0 commit comments