It uses Unity's Input System to implement the player's bullet firing process.

In Action of ActionMaps, Action Type is Button, Interaction is Press, and Trigger behavior is Press only, but the method is called at the time of Press and Release.

Corresponding source code

Action Maps image

A script that implements the callback
The implementation uses an interface.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class Controller: MonoBehaviour, PlayerInput.IPlayerActions
    private PlayerInput.PlayerActions input;
    public void OnShot (InputAction.CallbackContext context)
        // Processing to be performed when key input
        hoge ();
    // omitted after
What I tried

After setting Trigger behavior to Press Only, I generated a C # class for Input Actions, but it didn't improve.

If (context.performed) has confirmed normal operation.

Version of use

Unity 2019.4.12f1
Input System 1.0.0 --April 29,2020
Microsoft Visual Studio Community 2019 Version 16.7.7

  • Answer # 1

    I tried various things, but Interactions seems to not be called at Release when using "Tap" instead of "Press".