0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Unity】ChatGPTでは解決しないエラー "you have switched active Input handling to Input System package in Player Settings"

Posted at

まえがき

スクリプトとエラーメッセージを見せれば、大抵の問題は解決できるChatGPTだが、たまに壁に当たることがある。

今回がそのパターンで、以下のエラーメッセージに対して、ChatGPTは歯が立たなかった。

コンソール
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.
UnityEngine.Input.GetKeyDown (UnityEngine.KeyCode key) (略)
yyy.Update () (at Assets/Scripts/xxxScene/yyy.cs:104)

これは、UnityでOpenXR開発をしていて、キーボード入力を追加しようとしたときに吐いたエラー。

解決方法

入力に使うInput ManagerとInput System Packageが混在していると起きるようだ。

理想は新しいInput System Packageで全て書くことかもしれないが、面倒なので、以下の設定をして、両方対応させた。

image.png

プロジェクトセッティング→プレイヤー→Active Input Handingを選択。

ここをBoth(両方)に変更すると、どちらも使えるようになる。尚、この時にプロジェクトが再起動するので注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?