Migrate to the 1.0.0-beta Input SDK

This guide describes how to migrate your Unity game to use the latest Input SDK. The 1.0.0-beta SDK has substantial improvements over the previous 0.0.4 preview. You should migrate from the earlier previews as soon as possible. The 0.0.4 SDK will continue to function through March 2023.

Update references

Classes received the Play prefix to avoid naming collisions with Unity. Whenever you see the an error message similar to:

error CS0246: The type or namespace name 'InputMappingProvider' could not be found (are you missing a using directive or an assembly reference?)

you must add the Play prefix to the class name. For example, InputMappingProvider becomes PlayInputMappingProvider.

Update each InputAction

InputAction is now constructed with a call to PlayInputAction.Create as opposed to creating a new struct with named fields.

Locate any code that calls new InputAction:

vardriveAction=newInputAction
{
ActionLabel="Drive",
UniqueId=(int)InputEventIds.DRIVE,
InputControls=newInputControls
{
AndroidKeycodes=new[]{AndroidKeyCode.KEYCODE_SPACE}
}
};

And replace it with a call to PlayInputAction.Create:

vardriveAction=PlayInputAction.Create(
"Drive",
(int)InputEventIds.DRIVE,
PlayInputControls.Create(
new[]{AndroidKeyCode.KEYCODE_SPACE},
null
)
);

Update each InputGroup

Like InputAction, InputGroup now has an PlayInputGroup.Create call rather than requiring that you manually fill out a struct.

This means that you should locate any calls to new InputGroup:

vargameInputGroup=newInputGroup
{
GroupLabel="Game controls",
InputActions=newList<InputAction>
{
driveAction,
turboAction,
openGarageAction,
openStoreAction
}
};

And replace it to a call to PlayInputGroup.Create:

vargameInputGroup=PlayInputGroup.Create(
"Game controls",
newList<PlayInputAction>
{
driveAction,
turboAction,
openGarageAction,
openStoreAction
}
);

Update the InputMap

InputMap uses PlayInputMap.Create as well instead of constructing a new struct.

Locate any calls to new InputMap:

returnnewInputMap
{
InputGroups=newList<InputGroup>
{
gameInputGroup,
menuInputGroup
},
MouseSettings=newMouseSettings
{
AllowMouseSensitivityAdjustment=false,
InvertMouseMovement=false
}
};

And replace it with a call to PlayInputMap.Create:

returnPlayInputMap.Create(
newList<PlayInputGroup>
{
gameInputGroup,
menuInputGroup
},
PlayMouseSettings.Create(false,false)
);

Rename the PlayInputMappingClient methods

For PlayInputMappingClient, RegisterInputMappingProvider has been renamed to SetInputMappingProvider.

So locate any calls to RegisterInputMappingProvider:

Input.GetInputMappingClient().RegisterInputMappingProvider(_inputMappingProvider);

And replace them with a call to SetInputMappingProvider:

PlayInputMappingClientinputMappingClient=
Google.Play.InputMapping.PlayInput.GetInputMappingClient();
inputMappingClient.SetInputMappingProvider(_inputMapProvider);

UnregisterInputMappingProvider has also been renamed to ClearInputMappingProvider and no longer requires your previously registered InputMappingProvider as a parameter.

Locate any calls to UnregisterInputMappingProvider:

Input.GetInputMappingClient().UnregisterInputMappingProvider(_inputMapProvider);

And replace them with ClearInputMappingProvider:

PlayInput.GetInputMappingClient().ClearInputMappingProvider();

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026年06月09日 UTC.