2
2

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.

FungusをInputSystemに対応させるメモ

Posted at

2022年11月現在のUnityでは、入力を従来の InputManager ではなく、 InputSystem で扱うのがお行儀が良いとされています。

そして、会話シーンを作成する補助のアセットとして Fungus というものがあります。
ですがこれはInputManager用に作られており、そのままではInputSystemに対応してくれません。

手順1. Input Actionを作って、クラスを生成する

これはググればすぐ出てきます。
これとか。

手順2. FungusのasmdefにUnityEngine.InputSystemの参照を追加する

プロジェクトビューからAssets > Fungus > Fungus.asmdefを選択し、インスペクタの「Assembly Defnition References」に「Unity.InputSystem」を追加します。

手順3. DialogInput.csを書き換える

DialogInput.cs
if (Input.GetButtonDown(currentStandaloneInputModule.submitButton) ||
(cancelEnabled && Input.GetButton(currentStandaloneInputModule.cancelButton)))
{
    SetNextLineFlag();
}

これを、

DialogInput.cs
if (_actions.UI.Submit.WasPerformedThisFrame() || (cancelEnabled && _actions.UI.Cancel.IsPressed()))
{
    SetNextLineFlag();
}

こういう感じにしてあげれば上手く行きます。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?