⚠ Preview docs — built from the develop branch and may be unstable. Go to the stable docs.

static class BtnStateExtensions

A collection of extension methods for the BtnState enum that makes bit-field checks a little easier.

Static Methods

   
IsActive Is the button pressed?
IsChanged Was the button either presses or released this frame?
IsJustActive Has the button just been pressed this frame?
IsJustCanceled Was a button activation just canceled this frame, ending without firing because the interactor moved too far away?
IsJustInactive Has the button just been released this frame?
Make Creates a Button State using the current and previous frame’s state! These two states allow us to add the “JustActive” and “JustInactive” bitflags when changes happen.

Examples

BtnState state = Input.Hand(Handed.Right).pinch;

// You can check a BtnState using bit-flag logic
if ((state & BtnState.Changed) > 0)
	Log.Info("Pinch state just changed!");

// Or you can check the same values with the extension methods, no
// bit flag logic :)
if (state.IsChanged())
	Log.Info("Pinch state just changed!");




Found an issue with these docs, or have some additional questions? Create an Issue on Github!