1- using UnityEngine ;
1+ using System . Text ;
2+ using UnityEngine ;
23using UnityEditor ;
34using UnityEditor . AnimatedValues ;
45using System ;
@@ -218,34 +219,20 @@ void InitComponentMethods(bool resetIndex = true) {
218219 else
219220 AddComponentMethod ( component ) ;
220221 if ( ctorMode )
221- methodNames = methods . Select ( m => m . ctorInfo != null ?
222- string . Format (
223- "[Constructor] ({0} parameters)" ,
224- m . ctorInfo . GetParameters ( ) . Length
225- ) : string . Format (
226- "{0} ({1} parameters)" ,
227- Helper . GetMemberName ( m . method as MemberInfo ) ,
228- m . method . GetParameters ( ) . Length
229- )
230- ) . ToArray ( ) ;
222+ methodNames = methods . Select ( ( m , i ) => GetMethodNameFormatted ( m , i ) ) . ToArray ( ) ;
231223 else if ( drawHeader ) {
232224 var gameObject = component as GameObject ;
233225 if ( gameObject != null )
234226 foreach ( var c in gameObject . GetComponents ( typeof ( Component ) ) )
235227 AddComponentMethod ( c ) ;
236- methodNames = methods . Select ( m => string . Format (
237- "{0} ({1})/{2} ({3} parameters) " ,
228+ methodNames = methods . Select ( ( m , i ) => string . Format (
229+ "{0} ({1})/{2}" ,
238230 m . target . GetType ( ) . Name ,
239231 Helper . ObjIdOrHashCode ( m . target ) ,
240- Helper . GetMemberName ( m . method as MemberInfo ) ,
241- m . method . GetParameters ( ) . Length
232+ GetMethodNameFormatted ( m , i )
242233 ) ) . ToArray ( ) ;
243234 } else {
244- methodNames = methods . Select ( m => string . Format (
245- "{0} ({1} parameters)" ,
246- Helper . GetMemberName ( m . method as MemberInfo ) ,
247- m . method . GetParameters ( ) . Length
248- ) ) . ToArray ( ) ;
235+ methodNames = methods . Select ( ( m , i ) => GetMethodNameFormatted ( m , i ) ) . ToArray ( ) ;
249236 }
250237 if ( ! resetIndex && selectedMethod != null ) {
251238 selectedMethodIndex = methods . FindIndex ( m => m . method == selectedMethod ) ;
@@ -261,6 +248,21 @@ void InitComponentMethods(bool resetIndex = true) {
261248 thrownException = null ;
262249 }
263250
251+ string GetMethodNameFormatted ( ComponentMethod m , int i ) {
252+ string name ;
253+ MethodBase method ;
254+ if ( m . ctorInfo != null ) {
255+ method = m . ctorInfo ;
256+ name = "[Constructor]" ;
257+ } else {
258+ method = m . method ;
259+ name = Helper . GetMemberName ( method as MemberInfo ) ;
260+ }
261+ var result = string . Format ( "{0} {1} ({2})" , i + 1 , name , Helper . JoinStringList ( null , method . GetParameters ( ) . Select ( x => x . ParameterType . Name ) , ", " ) ) ;
262+ result = result . Replace ( " _" , "_" ) ;
263+ return result ;
264+ }
265+
264266 void InitMethodParams ( ) {
265267 selectedCtor = methods [ selectedMethodIndex ] . ctorInfo ;
266268 if ( selectedCtor != null ) {
0 commit comments