unity 如何切换输入系统(Input System)

问题描述:

在 Unity2019 版本中,加入了新的 Input System Package,当导入包的时候可能会将旧的输入系统禁用。这时如果再打开使用旧的输入系统的项目可能会出现异常。

InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
UnityStandardAssets.CrossPlatformInput.PlatformSpecific.StandaloneInput.GetButtonDown (System.String name) (at Assets/Plugins/Standard Assets/CrossPlatformInput/Scripts/PlatformSpecific/StandaloneInput.cs:22)
UnityStandardAssets.CrossPlatformInput.CrossPlatformInputManager.GetButtonDown (System.String name) (at Assets/Plugins/Standard Assets/CrossPlatformInput/Scripts/CrossPlatformInputManager.cs:121)
UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl.Update () (at Assets/Plugins/Standard Assets/Characters/ThirdPersonCharacter/Scripts/ThirdPersonUserControl.cs:40)

解决方法:

可以在 Player Setting 中对项目使用的Input System 进行切换。

Edit => Project Setting => Player => Other Settings => Active Input Handling

unity 如何切换输入系统(Input System)_第1张图片
通过在设置中选择正确的输入系统就可以解决这个异常。

  • 注意,在切换输入系统之后,编辑器会自动重启以生效。

官方论坛的相关问题

你可能感兴趣的:(Unity)