File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -413,7 +413,29 @@ private ulong HashMethodName(string name)
413413
414414 return 0 ;
415415 }
416-
416+
417+ private MethodInfo [ ] GetNetworkedBehaviorChildClassesMethods ( Type type , List < MethodInfo > list = null )
418+ {
419+ if ( list == null )
420+ {
421+ list = new List < MethodInfo > ( ) ;
422+ list . AddRange ( type . GetMethods ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ) ;
423+ }
424+ else
425+ {
426+ list . AddRange ( type . GetMethods ( BindingFlags . NonPublic | BindingFlags . Instance ) ) ;
427+ }
428+
429+ if ( type . BaseType != null && type . BaseType != typeof ( NetworkedBehaviour ) )
430+ {
431+ return GetNetworkedBehaviorChildClassesMethods ( type . BaseType , list ) ;
432+ }
433+ else
434+ {
435+ return list . ToArray ( ) ;
436+ }
437+ }
438+
417439 private void CacheAttributes ( )
418440 {
419441 Type type = GetType ( ) ;
@@ -425,7 +447,7 @@ private void CacheAttributes()
425447 if ( Methods . ContainsKey ( type ) ) methods = Methods [ type ] ;
426448 else
427449 {
428- methods = type . GetMethods ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) ;
450+ methods = GetNetworkedBehaviorChildClassesMethods ( type ) ;
429451 Methods . Add ( type , methods ) ;
430452 }
431453
You can’t perform that action at this time.
0 commit comments