そういうのがいいブログ

アプリ個人開発 まるブログ

アプリ開発覚え書き

【Unity】Androidビルド時の警告 PlayerSettings->Active Input Handling is set to Both, this is unsupported on Android and might cause issues with input and application performance. Please choose only one active input handling. Ignore and continue? (This dialog won't

要件

Unity 6000.0.55f1

はじめに

Androidにてビルドしたところ、下記の警告が発生したので対応をメモ

PlayerSettings->Active Input Handling is set to Both, this is unsupported on Android and might cause issues with input and application performance. Please choose only one active input handling. Ignore and continue? (This dialog won't appear again in this Editor session if you'll choose Yes)

警告内容

プロジェクト設定の Active Input Handling をどれにすべきか聞かれています。
「Active Input Handling」は入力方式(旧 Input Manager、新 Input System)を選択する設定です。

現在は Both(旧 Input Manager + 新 Input System の両方) に設定されていますが、
Android では Both は公式にサポートされていません。
そのため、入力の競合やパフォーマンス低下を防ぐ目的で Unity が警告を出しています。

どちらにすべき?

Input Manager (Old) が良いとき

  • タッチ操作だけの Android アプリを開発する場合
  • 生成AIを活用してコードを書く場合(情報量が豊富でコード例が出やすい)
  • 過去の旧Input Manager用コードやアセットを流用したい場合
  • 初期設定を簡単に済ませたい場合

メリット:
UIボタンやタッチ入力が設定なしでそのまま動作し、
学習コストが低い。Androidビルドでも安定して動く。

Input System Package (New) が良いとき

  • PC対応やゲームパッド対応を予定している場合
  • キーボード、マウス、タッチ、コントローラーなど複数の入力デバイスを統一的に扱いたい場合
  • 入力マッピングやカスタマイズ性を重視する場合
  • 新しいAPIで将来的な拡張を見据えている場合

注意点:
UIボタンやタッチ入力を使う場合はInput System UI Input Moduleへの切り替えが必要。
旧Input Managerのコードはそのままでは動かないため書き換えが必要。


設定方法

  1. Unity メニューから 編集 > プロジェクト設定 > プレイヤー を開く

  2. アクティブな入力規則 のプルダウンを以下のいずれかに変更
     ・入力マネージャー(旧)
     ・入力システムパッケージ(新)

  3. Unity を再起動して反映


旧版に設定すると・・・

旧版に設定して再起動すると下記の警告が発生します。 旧版で使うなら「No」を押します。

This project is using the new input system package but the native platform backends for the new input system are not enabled in the player settings. This means that no input from native devices will come through.

Do you want to enable the backends? Doing so will RESTART the editor.

おわりに

Unityとしては、「 Input System Package (New)」を推奨していくはずですので、
新規プロジェクトであれば、 Input System Package (New)を採用した方が良さそうですね。