Component:ButtonValueShift

From Resonite Wiki
Revision as of 00:18, 12 September 2024 by AmasterAmaster (talk | contribs) (This is no longer a stub. Added a field description. Style. Added Related issue description. Added links.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Component image 
Button Value Shift`1 component as seen in the Scene Inspector


The ButtonValueShift component can be used to make an IButton add the delta amount to a value whenever it is pressed.

Fields

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.
TargetValue IField`1<T> The value to shift.
Delta T By how much TargetValue should be shifted on each press.
Min T The minimum value that can be shifted to.
Max T The maximum value that can be shifted to.
WrapAround Bool Whether or not the value should wrap around to the other extreme when reaching either Min or Max.
MaxIsExclusive Bool When the current amount is at the value before max, it will stop there, unless wrap around is enabled, which then wraps around from the max value - 1.

Usage

To function, the component simply needs to be attached to a slot that also has a button component attached to it. From then on, pressing that button will activate the ButtonValueShift, making it shift its TargetValue by its Delta.

Examples

Related Issues

It is known that you can go over the maximum by setting the delta higher than the max or min values, allowing the output to be outside the ranges provided.

Related Components