当前位置:   article > 正文

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

unity中切换输入系统

问题描述:

在 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)

  • 1
  • 2
  • 3
  • 4
  • 5

解决方法:

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

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

在这里插入图片描述
通过在设置中选择正确的输入系统就可以解决这个异常。

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

官方论坛的相关问题

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/48515
推荐阅读
相关标签
  

闽ICP备14008679号