@@ -2679,12 +2679,17 @@ public void Actions_CanConvertActionMapToAndFromJson()
26792679 //Give action maps stable internal names (just like actions)
26802680 var map = new InputActionMap ( "test" ) ;
26812681
2682- map . AddAction ( name : "action1" , expectedControlLayout : "Button" , binding : "/gamepad/leftStick" )
2682+ var action1 = map . AddAction ( name : "action1" , expectedControlLayout : "Button" , binding : "/gamepad/leftStick" ) ;
2683+ action1
26832684 . AddBinding ( "/gamepad/rightStick" )
26842685 . WithGroup ( "group" )
26852686 . WithProcessor ( "deadzone" ) ;
26862687 map . AddAction ( name : "action2" , binding : "/gamepad/buttonSouth" , interactions : "tap,slowTap(duration=0.1)" ) ;
26872688
2689+ // Add binding with an empty path and make sure we persist that correctly.
2690+ // https://fogbugz.unity3d.com/f/cases/1231968/
2691+ action1 . AddBinding ( "" ) ;
2692+
26882693 var json = map . ToJson ( ) ;
26892694 var maps = InputActionMap . FromJson ( json ) ;
26902695
@@ -2698,8 +2703,12 @@ public void Actions_CanConvertActionMapToAndFromJson()
26982703 Assert . That ( maps [ 0 ] . actions [ 1 ] . id , Is . EqualTo ( map [ "action2" ] . id ) ) ;
26992704 Assert . That ( maps [ 0 ] . actions [ 0 ] . expectedControlType , Is . EqualTo ( "Button" ) ) ;
27002705 Assert . That ( maps [ 0 ] . actions [ 1 ] . expectedControlType , Is . Null ) ;
2701- Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings , Has . Count . EqualTo ( 2 ) ) ;
2706+ Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings , Has . Count . EqualTo ( 3 ) ) ;
27022707 Assert . That ( maps [ 0 ] . actions [ 1 ] . bindings , Has . Count . EqualTo ( 1 ) ) ;
2708+ Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 0 ] . path , Is . EqualTo ( "/gamepad/leftStick" ) ) ;
2709+ Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 1 ] . path , Is . EqualTo ( "/gamepad/rightStick" ) ) ;
2710+ Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 2 ] . path , Is . Not . Null ) ;
2711+ Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 2 ] . path , Is . Empty ) ;
27032712 Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 0 ] . groups , Is . Null ) ;
27042713 Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 1 ] . groups , Is . EqualTo ( "group" ) ) ;
27052714 Assert . That ( maps [ 0 ] . actions [ 0 ] . bindings [ 0 ] . processors , Is . Null ) ;
0 commit comments