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