Component:VirtualKey: Difference between revisions

From Resonite Wiki
add mega info I hope
Add info about sending key presses outside of Resonite
Line 20: Line 20:
== Behavior ==
== Behavior ==
When paired with a UIX button or physical button on the same slot, it allows for simulation of key presses as if they came from the actual physical keyboard. This can be used for some funny effects where pressing a button forces the user that pressed it to jump (or, god forbid, make them switch to desktop or VR)
When paired with a UIX button or physical button on the same slot, it allows for simulation of key presses as if they came from the actual physical keyboard. This can be used for some funny effects where pressing a button forces the user that pressed it to jump (or, god forbid, make them switch to desktop or VR)
This cannot be used to send key presses outside of Resonite to control the external operating system unless the component in in [[Userspace]].


== Examples ==
== Examples ==

Revision as of 22:50, 16 October 2024

Component image 
Virtual Key component as seen in the Scene Inspector

Virtual key is a component that turns a button event into a button press on the keyboard in game as if it came from the physical keyboard.

Usage

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
TargetKey Key The key to simulate.
AppendString String What text to append if the user is focused into a text field
ShiftTargetKey Key What key to use if the Virtual Shift component is taking effect, or shift is held on the physical keyboard.
ShiftAppendString String What text to append if the user is focused into a text field and if the Virtual Shift component is taking effect, or shift is held on the physical keyboard.
IgnoreShift Bool Whether to ignore shift and virtual shift keys entirely.
ModifierKey direct RelayRef`1<VirtualModifierKey> A key that can act as a special modifier (for example, if you wanted a key on your VR keyboard that appended "Cat!!" every time you type a letter)
ModifiedTargetKey Key The key to use instead of TargetKey when ModifiedTargetKey is pressed down.
ModifiedAppendString String hat text to append if the user is focused into a text field and the key specified by ModifiedTargetKey is pressed down.
Keyboard direct RelayRef`1<VirtualKeyboard> The keyboard object this key is a part of.

Behavior

When paired with a UIX button or physical button on the same slot, it allows for simulation of key presses as if they came from the actual physical keyboard. This can be used for some funny effects where pressing a button forces the user that pressed it to jump (or, god forbid, make them switch to desktop or VR)

This cannot be used to send key presses outside of Resonite to control the external operating system unless the component in in Userspace.

Examples

Used in the default and custom community keyboards to allow said keyboards to type into the game and textfields.

See Also