File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1
1
#if UNITY_2019_3_OR_NEWER
2
2
using System ;
3
+ using System . Collections . Generic ;
3
4
using System . Reflection ;
4
5
using UnityEditor ;
5
6
using UnityEngine ;
6
7
7
8
namespace MackySoft . SerializeReferenceExtensions . Editor {
8
9
public static class ManagedReferenceUtility {
9
10
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
+
10
32
public static object SetManagedReference ( this SerializedProperty property , Type type ) {
11
33
object result = null ;
12
34
You can’t perform that action at this time.
0 commit comments