@@ -306,6 +306,23 @@ public static BindingSyntax AddBinding(this InputAction action, string path, str
306306            } ) ; 
307307        } 
308308
309+         /// <summary> 
310+         /// Conditionally compiled helper for logging API usage of code-authored actions. 
311+         /// </summary> 
312+         /// <param name="api">The associated API function.</param> 
313+         /// <remarks> 
314+         /// Be extremely carefully to review for indirect calls and overloads to not register analytics twice. 
315+         /// Be extremely careful in enabling/disabling tracking before internal calls since those may otherwise 
316+         /// be incorrectly registered. 
317+         /// </remarks> 
318+         #if UNITY_EDITOR 
319+         private  static   void  RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api  api ) 
320+         { 
321+             UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Register ( api ) ; 
322+         } 
323+ 
324+         #endif
325+ 
309326        /// <summary> 
310327        /// Add a binding that references the given <paramref name="control"/> and triggers 
311328        /// the given <paramref cref="action"/>. 
@@ -349,6 +366,10 @@ public static BindingSyntax AddBinding(this InputAction action, InputControl con
349366        /// </remarks> 
350367        public  static   BindingSyntax  AddBinding ( this  InputAction  action ,  InputBinding  binding  =  default ) 
351368        { 
369+             #if UNITY_EDITOR 
370+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . AddBinding ) ; 
371+             #endif
372+ 
352373            if  ( action  ==  null ) 
353374                throw  new  ArgumentNullException ( nameof ( action ) ) ; 
354375
@@ -478,6 +499,10 @@ public static BindingSyntax AddBinding(this InputActionMap actionMap, string pat
478499        /// <seealso cref="InputActionMap.bindings"/> 
479500        public  static   BindingSyntax  AddBinding ( this  InputActionMap  actionMap ,  InputBinding  binding ) 
480501        { 
502+             #if UNITY_EDITOR 
503+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . AddBinding ) ; 
504+             #endif
505+ 
481506            if  ( actionMap  ==  null ) 
482507                throw  new  ArgumentNullException ( nameof ( actionMap ) ) ; 
483508            if  ( binding . path  ==  null ) 
@@ -501,6 +526,10 @@ public static BindingSyntax AddBinding(this InputActionMap actionMap, InputBindi
501526        public  static   CompositeSyntax  AddCompositeBinding ( this  InputAction  action ,  string  composite , 
502527            string  interactions  =  null ,  string  processors  =  null ) 
503528        { 
529+             #if UNITY_EDITOR 
530+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . AddCompositeBinding ) ; 
531+             #endif
532+ 
504533            if  ( action  ==  null ) 
505534                throw  new  ArgumentNullException ( nameof ( action ) ) ; 
506535            if  ( string . IsNullOrEmpty ( composite ) ) 
@@ -580,6 +609,10 @@ private static int AddBindingInternal(InputActionMap map, InputBinding binding,
580609        /// of <paramref name="action"/>).</exception> 
581610        public  static   BindingSyntax  ChangeBinding ( this  InputAction  action ,  int  index ) 
582611        { 
612+             #if UNITY_EDITOR 
613+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ChangeBinding ) ; 
614+             #endif
615+ 
583616            if  ( action  ==  null ) 
584617                throw  new  ArgumentNullException ( nameof ( action ) ) ; 
585618
@@ -638,6 +671,10 @@ public static BindingSyntax ChangeBinding(this InputAction action, string name)
638671        /// of <paramref name="actionMap"/>).</exception> 
639672        public  static   BindingSyntax  ChangeBinding ( this  InputActionMap  actionMap ,  int  index ) 
640673        { 
674+             #if UNITY_EDITOR 
675+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ChangeBinding ) ; 
676+             #endif
677+ 
641678            if  ( actionMap  ==  null ) 
642679                throw  new  ArgumentNullException ( nameof ( actionMap ) ) ; 
643680            if  ( index  <  0  ||  index  >=  actionMap . m_Bindings . LengthSafe ( ) ) 
@@ -836,6 +873,10 @@ public static BindingSyntax ChangeBinding(this InputAction action, InputBinding
836873        /// <seealso cref="InputBindingComposite"/> 
837874        public  static   BindingSyntax  ChangeCompositeBinding ( this  InputAction  action ,  string  compositeName ) 
838875        { 
876+             #if UNITY_EDITOR 
877+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ChangeCompositeBinding ) ; 
878+             #endif
879+ 
839880            if  ( action  ==  null ) 
840881                throw  new  ArgumentNullException ( nameof ( action ) ) ; 
841882            if  ( string . IsNullOrEmpty ( compositeName ) ) 
@@ -877,6 +918,10 @@ public static BindingSyntax ChangeCompositeBinding(this InputAction action, stri
877918        /// </remarks> 
878919        public  static   void  Rename ( this  InputAction  action ,  string  newName ) 
879920        { 
921+             #if UNITY_EDITOR 
922+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . Rename ) ; 
923+             #endif
924+ 
880925            if  ( action  ==  null ) 
881926                throw  new  ArgumentNullException ( nameof ( action ) ) ; 
882927            if  ( string . IsNullOrEmpty ( newName ) ) 
@@ -919,6 +964,10 @@ public static void Rename(this InputAction action, string newName)
919964        /// </remarks> 
920965        public  static   void  AddControlScheme ( this  InputActionAsset  asset ,  InputControlScheme  controlScheme ) 
921966        { 
967+             #if UNITY_EDITOR 
968+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . AddControlScheme ) ; 
969+             #endif
970+ 
922971            if  ( asset  ==  null ) 
923972                throw  new  ArgumentNullException ( nameof ( asset ) ) ; 
924973            if  ( string . IsNullOrEmpty ( controlScheme . name ) ) 
@@ -987,6 +1036,10 @@ public static ControlSchemeSyntax AddControlScheme(this InputActionAsset asset,
9871036        /// </remarks> 
9881037        public  static   void  RemoveControlScheme ( this  InputActionAsset  asset ,  string  name ) 
9891038        { 
1039+             #if UNITY_EDITOR 
1040+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . RemoveControlScheme ) ; 
1041+             #endif
1042+ 
9901043            if  ( asset  ==  null ) 
9911044                throw  new  ArgumentNullException ( nameof ( asset ) ) ; 
9921045            if  ( string . IsNullOrEmpty ( name ) ) 
@@ -1007,33 +1060,57 @@ public static void RemoveControlScheme(this InputActionAsset asset, string name)
10071060        /// <returns><paramref name="scheme"/></returns> 
10081061        public  static   InputControlScheme  WithBindingGroup ( this  InputControlScheme  scheme ,  string  bindingGroup ) 
10091062        { 
1063+             #if UNITY_EDITOR 
1064+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ControlSchemeWithBindingGroup ) ; 
1065+             #endif
1066+ 
10101067            return  new  ControlSchemeSyntax ( scheme ) . WithBindingGroup ( bindingGroup ) . Done ( ) ; 
10111068        } 
10121069
10131070        public  static   InputControlScheme  WithDevice ( this  InputControlScheme  scheme ,  string  controlPath ,  bool  required ) 
10141071        { 
1072+             #if UNITY_EDITOR 
1073+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ControlSchemeWithDevice ) ; 
1074+             #endif
1075+ 
10151076            if  ( required ) 
10161077                return  new  ControlSchemeSyntax ( scheme ) . WithRequiredDevice ( controlPath ) . Done ( ) ; 
10171078            return  new  ControlSchemeSyntax ( scheme ) . WithOptionalDevice ( controlPath ) . Done ( ) ; 
10181079        } 
10191080
10201081        public  static   InputControlScheme  WithRequiredDevice ( this  InputControlScheme  scheme ,  string  controlPath ) 
10211082        { 
1083+             #if UNITY_EDITOR 
1084+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ControlSchemeWithRequiredDevice ) ; 
1085+             #endif
1086+ 
10221087            return  new  ControlSchemeSyntax ( scheme ) . WithRequiredDevice ( controlPath ) . Done ( ) ; 
10231088        } 
10241089
10251090        public  static   InputControlScheme  WithOptionalDevice ( this  InputControlScheme  scheme ,  string  controlPath ) 
10261091        { 
1092+             #if UNITY_EDITOR 
1093+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ControlSchemeWithOptionalDevice ) ; 
1094+             #endif
1095+ 
10271096            return  new  ControlSchemeSyntax ( scheme ) . WithOptionalDevice ( controlPath ) . Done ( ) ; 
10281097        } 
10291098
10301099        public  static   InputControlScheme  OrWithRequiredDevice ( this  InputControlScheme  scheme ,  string  controlPath ) 
10311100        { 
1101+             #if UNITY_EDITOR 
1102+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ControlSchemeOrWithRequiredDevice ) ; 
1103+             #endif
1104+ 
10321105            return  new  ControlSchemeSyntax ( scheme ) . OrWithRequiredDevice ( controlPath ) . Done ( ) ; 
10331106        } 
10341107
10351108        public  static   InputControlScheme  OrWithOptionalDevice ( this  InputControlScheme  scheme ,  string  controlPath ) 
10361109        { 
1110+             #if UNITY_EDITOR 
1111+             RegisterApiUsage ( UnityEngine . InputSystem . Editor . InputExitPlayModeAnalytic . Api . ControlSchemeOrWithOptionalDevice ) ; 
1112+             #endif
1113+ 
10371114            return  new  ControlSchemeSyntax ( scheme ) . OrWithOptionalDevice ( controlPath ) . Done ( ) ; 
10381115        } 
10391116
0 commit comments