Gamepad Released this Frame#
Input / Gamepad Released this Frame
Can Read
Cannot Write
Description#
Returns true the frame the specified Gamepad button is released
Parameters#
| Name | Description |
|---|---|
| Button | The Gamepad button that is checked |
Code#
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Inline(nameof(m_Button))]
[Title("Gamepad Released this Frame")]
[Category("Input/Gamepad Released this Frame")]
[Description("Returns true the frame the specified Gamepad button is released")]
[Image(typeof(IconGamepad), ColorTheme.Type.Blue, typeof(BadgeArrowUp))]
[Parameter("Button", "The Gamepad button that is checked")]
[Keywords("Button", "Up", "Just", "Ended")]
[Serializable]
public class TypeBoolInputGamepadReleaseThisFrame : TypeBool
{
[SerializeField] private GamepadButton m_Button = GamepadButton.South;
public override bool Get(Args args)
{
Gamepad gamepad = Gamepad.current;
return gamepad != null && gamepad[this.m_Button].wasReleasedThisFrame;
}
public override string ToString()
{
return $"Released {this.m_Button}";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}