@@ -59,24 +59,23 @@ static void CopyEntry(SerializedProperty spAxis, InputManagerEntry entry)
5959
6060 static void AddEntriesWithoutCheck ( SerializedProperty spAxes , List < InputManagerEntry > newEntries )
6161 {
62- int startRange = spAxes . arraySize ;
63- int endRange = startRange + newEntries . Count ;
64- spAxes . arraySize = endRange ;
62+ int endOfCurrentInputList = spAxes . arraySize ;
63+ spAxes . arraySize = endOfCurrentInputList + newEntries . Count ;
6564
66- for ( int i = startRange ; i < endRange ; ++ i )
67- CopyEntry ( spAxes . GetArrayElementAtIndex ( i ) , newEntries [ i ] ) ;
65+ SerializedProperty spAxis = spAxes . GetArrayElementAtIndex ( endOfCurrentInputList ) ;
66+ for ( int i = 0 ; i < newEntries . Count ; ++ i , spAxis . Next ( false ) )
67+ CopyEntry ( spAxis , newEntries [ i ] ) ;
6868 }
6969
7070 // Get a representation of the already registered inputs
7171 static List < ( string name , InputManagerEntry . Kind kind ) > GetCachedInputs ( SerializedProperty spAxes )
7272 {
7373 int size = spAxes . arraySize ;
7474 List < ( string name , InputManagerEntry . Kind kind ) > result = new List < ( string name , InputManagerEntry . Kind kind ) > ( size ) ;
75- for ( int i = 0 ; i < size ; ++ i )
76- {
77- var spAxis = spAxes . GetArrayElementAtIndex ( i ) ;
75+
76+ SerializedProperty spAxis = spAxes . GetArrayElementAtIndex ( 0 ) ;
77+ for ( int i = 0 ; i < size ; ++ i , spAxis . Next ( false ) )
7878 result . Add ( ( spAxis . FindPropertyRelative ( "m_Name" ) . stringValue , ( InputManagerEntry . Kind ) spAxis . FindPropertyRelative ( "type" ) . intValue ) ) ;
79- }
8079 return result ;
8180 }
8281
0 commit comments