Gamepad Right Trigger#
Input / Gamepad Right Trigger
Can Read
Cannot Write
Description#
Returns how much the Right Trigger of the current Gamepad is pressed
Code#
using System;
using UnityEngine.InputSystem;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Gamepad Right Trigger")]
[Category("Input/Gamepad Right Trigger")]
[Description("Returns how much the Right Trigger of the current Gamepad is pressed")]
[Image(typeof(IconGamepadSlider), ColorTheme.Type.Blue, typeof(BadgeArrowRight))]
[Keywords("Analog", "Axis", "Shoulder", "R2", "RT")]
[Serializable]
public class TypeNumberInputGamepadRightTrigger : TypeNumber
{
public override double Get(Args args)
{
Gamepad gamepad = Gamepad.current;
return gamepad != null ? gamepad.rightTrigger.ReadValue() : 0d;
}
public override string ToString()
{
return "Gamepad Right Trigger";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}