-
Notifications
You must be signed in to change notification settings - Fork 30
GetButtonUp
static bool GetButtonUp(XboxButton button);
static bool GetButtonUp(XboxButton button, XboxController controller);GetButtonUp() returns true the moment the specified XboxButton was released. The button had to be pressed down prior, and then released. It will return false any frame after the moment the button was released. This is useful for interacting with menu selection with an Xbox controller, for example.
-
XboxButton button: An identifier for the Xbox button you want to test. Please refer to XboxButton for all possible buttons. -
XboxController controller: An identifier for the specific controller on which to test the button. If this parameter isn't provided, all connected controllers will be tested for the specified button. It is recommended to omit this parameter if you are making a single player game. Please refer to XboxController for all possible controllers.
The example demonstrates the use of GetButtonDown() if you wanted any player to select "Begin Game" with the 'Start' button.
using UnityEngine;
using XboxCtrlrInput;
public class MenuExample : MonoBehavior
{
public bool isBeginGameSelected = true;
void Update()
{
if( XCI.GetButtonUp(XboxButton.Start) )
{
if(isBeginGameSelected)
{
// Begin the game
Application.LoadLevel("scnLevel1");
}
}
}
}