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

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

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

官方论坛的相关问题

  • 23
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值