### SimpleInput Key Polling Example Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Demonstrates how to use SimpleInput.GetKey, GetKeyDown, and GetKeyUp for polling key states. Includes examples of triggering virtual key clicks and mapping mouse buttons. ```csharp using UnityEngine; public class KeyInputExample : MonoBehaviour { void Update() { if (SimpleInput.GetKeyDown(KeyCode.Space)) Debug.Log("Space pressed"); if (SimpleInput.GetKey(KeyCode.LeftShift)) Debug.Log("Shift held"); if (SimpleInput.GetKeyUp(KeyCode.E)) Debug.Log("E released"); // Simulate a one-frame virtual key click from script SimpleInputHelper.TriggerKeyClick(KeyCode.E); // Map a mouse button to a key slot: // Add KeyInputKeyboard component with key = KeyCode.Mouse0 } } ``` -------------------------------- ### Get Axis Values with SimpleInput Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Use `GetAxis` for smoothed values suitable for animation blending and `GetAxisRaw` for instantaneous values. Global smoothing and dead zone parameters can be tuned via `SimpleInput.GetAxisSensitivity`, `SimpleInput.GetAxisDeadZone`, and `SimpleInput.GetAxisSnapValue`. ```csharp using UnityEngine; public class PlayerMovement : MonoBehaviour { private Rigidbody rb; void Awake() => rb = GetComponent(); void Update() { // Smoothed value – safe to use for animation blending float h = SimpleInput.GetAxis("Horizontal"); // e.g. 0.73 float v = SimpleInput.GetAxis("Vertical"); // e.g. -1.0 // Raw value – immediate, no lerp; good for discrete detection float hRaw = SimpleInput.GetAxisRaw("Horizontal"); // -1, 0, or 1 transform.Rotate(0f, h * 120f * Time.deltaTime, 0f, Space.World); rb.AddRelativeForce(new Vector3(0f, 0f, v) * 15f); // Tune smoothing globally SimpleInput.GetAxisSensitivity = 15f; // slower smoothing SimpleInput.GetAxisDeadZone = 0.05f; // snap to 0 threshold SimpleInput.GetAxisSnapValue = true; // jump through 0 on direction change } } ``` -------------------------------- ### SimpleInputHelper.TriggerMouseButtonClick Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Triggers a virtual mouse button click event. This can be used to simulate mouse clicks from code, for example, by AI input or other system events. ```APIDOC ## SimpleInputHelper.TriggerMouseButtonClick ### Description Triggers a virtual mouse button click event. This can be used to simulate mouse clicks from code, for example, by AI input or other system events. ### Method `SimpleInputHelper.TriggerMouseButtonClick(int buttonIndex)` ### Parameters #### Path Parameters - **buttonIndex** (int) - Required - The index of the mouse button to trigger (0 for left, 1 for right, 2 for middle). #### Query Parameters None #### Request Body None ### Request Example ```csharp SimpleInputHelper.TriggerMouseButtonClick(0); // Simulates a left mouse button click ``` ### Response #### Success Response (200) This method does not return a value. #### Response Example None ``` -------------------------------- ### Implement Custom Input Providers with SimpleInput Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Shows how to create and manage custom input providers for AxisInput, ButtonInput, MouseButtonInput, and KeyInput. Includes registering providers with StartTracking, updating their values, and unregistering with StopTracking. ```csharp using UnityEngine; public class NetworkInputProvider : MonoBehaviour { // All four input types private SimpleInput.AxisInput remoteHorizontal = new SimpleInput.AxisInput("Horizontal"); private SimpleInput.AxisInput remoteVertical = new SimpleInput.AxisInput("Vertical"); private SimpleInput.ButtonInput remoteJump = new SimpleInput.ButtonInput("Jump"); private SimpleInput.MouseButtonInput remoteFire = new SimpleInput.MouseButtonInput(0); private SimpleInput.KeyInput remoteReload = new SimpleInput.KeyInput(KeyCode.R); void OnEnable() { remoteHorizontal.StartTracking(); remoteVertical.StartTracking(); remoteJump.StartTracking(); remoteFire.StartTracking(); remoteReload.StartTracking(); SimpleInput.OnUpdate += OnUpdate; } void OnDisable() { remoteHorizontal.StopTracking(); remoteVertical.StopTracking(); remoteJump.StopTracking(); remoteFire.StopTracking(); remoteReload.StopTracking(); SimpleInput.OnUpdate -= OnUpdate; } void OnUpdate() { // Values come from network (placeholder): remoteHorizontal.value = GetNetworkAxis("h"); // e.g. -1..1 remoteVertical.value = GetNetworkAxis("v"); remoteJump.value = GetNetworkButton("jump"); remoteFire.value = GetNetworkButton("fire"); remoteReload.value = GetNetworkButton("reload"); } // Runtime rebinding – no need to stop/restart tracking public void RemapJump(string newButton) { remoteJump.Key = newButton; // e.g. "Jump2" } float GetNetworkAxis(string id) => 0f; // stub bool GetNetworkButton(string id) => false; // stub } ``` -------------------------------- ### Configure Touchpad for Camera Look Input Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Explains how to set up a Touchpad component for camera look controls, including rebinding axes, adjusting sensitivity, inverting vertical input, and reading raw axis values for camera rotation. ```csharp using SimpleInputNamespace; using UnityEngine; public class CameraLook : MonoBehaviour { [SerializeField] private Touchpad touchpad; private float yaw, pitch; void Start() { touchpad.xAxis.Key = "LookH"; touchpad.yAxis.Key = "LookV"; touchpad.sensitivity = 1.5f; touchpad.invertVertical = true; } void Update() { yaw += SimpleInput.GetAxisRaw("LookH") * 3f; pitch += SimpleInput.GetAxisRaw("LookV") * 3f; pitch = Mathf.Clamp(pitch, -80f, 80f); transform.localEulerAngles = new Vector3(pitch, yaw, 0f); } } ``` -------------------------------- ### SimpleInput.AxisInput / ButtonInput / MouseButtonInput / KeyInput (Custom Providers) Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Serializable subclasses for registering custom value sources. Create an instance, call StartTracking(), write to its value field, and call StopTracking() when done. ```APIDOC ## SimpleInput.AxisInput / ButtonInput / MouseButtonInput / KeyInput (Custom Providers) ### Description The four serializable `BaseInput` subclasses used to register custom value sources. Create one, call `StartTracking()` to register it with the singleton, write to its `value` field each frame, and call `StopTracking()` when done. The `Key` property can be changed at runtime to rebind without re-registering. ### Usage Example ```csharp using UnityEngine; public class NetworkInputProvider : MonoBehaviour { // All four input types private SimpleInput.AxisInput remoteHorizontal = new SimpleInput.AxisInput("Horizontal"); private SimpleInput.AxisInput remoteVertical = new SimpleInput.AxisInput("Vertical"); private SimpleInput.ButtonInput remoteJump = new SimpleInput.ButtonInput("Jump"); private SimpleInput.MouseButtonInput remoteFire = new SimpleInput.MouseButtonInput(0); private SimpleInput.KeyInput remoteReload = new SimpleInput.KeyInput(KeyCode.R); void OnEnable() { remoteHorizontal.StartTracking(); remoteVertical.StartTracking(); remoteJump.StartTracking(); remoteFire.StartTracking(); remoteReload.StartTracking(); SimpleInput.OnUpdate += OnUpdate; } void OnDisable() { remoteHorizontal.StopTracking(); remoteVertical.StopTracking(); remoteJump.StopTracking(); remoteFire.StopTracking(); remoteReload.StopTracking(); SimpleInput.OnUpdate -= OnUpdate; } void OnUpdate() { // Values come from network (placeholder): remoteHorizontal.value = GetNetworkAxis("h"); // e.g. -1..1 remoteVertical.value = GetNetworkAxis("v"); remoteJump.value = GetNetworkButton("jump"); remoteFire.value = GetNetworkButton("fire"); remoteReload.value = GetNetworkButton("reload"); } // Runtime rebinding – no need to stop/restart tracking public void RemapJump(string newButton) { remoteJump.Key = newButton; // e.g. "Jump2" } float GetNetworkAxis(string id) => 0f; // stub bool GetNetworkButton(string id) => false; // stub } ``` ``` -------------------------------- ### Configure Dpad and Read Discrete Axis Values Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Shows how to bind a Dpad component to custom axes and read discrete -1, 0, or 1 values for grid-based movement. Also demonstrates direct reading of the Dpad's normalized value. ```csharp using SimpleInputNamespace; using UnityEngine; public class DpadUser : MonoBehaviour { [SerializeField] private Dpad dpad; void Start() { // Bind Dpad to alternative axes dpad.xAxis.Key = "DpadH"; dpad.yAxis.Key = "DpadV"; } void Update() { // Values are -1, 0, or 1 — perfect for grid movement int dH = Mathf.RoundToInt(SimpleInput.GetAxisRaw("DpadH")); // -1, 0, 1 int dV = Mathf.RoundToInt(SimpleInput.GetAxisRaw("DpadV")); // -1, 0, 1 if (dH != 0 || dV != 0) transform.Translate(new Vector3(dH, 0, dV) * Time.deltaTime * 5f); // Direct component read Vector2 raw = dpad.Value; } } ``` -------------------------------- ### Subscribe to SimpleInput.OnUpdate Event Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Demonstrates subscribing to the SimpleInput.OnUpdate event to execute custom input provider logic before other MonoBehaviour Update calls. This ensures input values are ready when gameplay code reads them. ```csharp using UnityEngine; public class CustomAccelerometer : MonoBehaviour { public SimpleInput.AxisInput tiltX = new SimpleInput.AxisInput("Horizontal"); public SimpleInput.AxisInput tiltY = new SimpleInput.AxisInput("Vertical"); void OnEnable() { tiltX.StartTracking(); tiltY.StartTracking(); SimpleInput.OnUpdate += OnUpdate; // runs before gameplay Update } void OnDisable() { tiltX.StopTracking(); tiltY.StopTracking(); SimpleInput.OnUpdate -= OnUpdate; } void OnUpdate() { // Feed device accelerometer into virtual axes each frame tiltX.value = Input.acceleration.x * 2f; tiltY.value = Input.acceleration.y * 2f; } } ``` -------------------------------- ### Bind SteeringWheel and Read Input for Car Control Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Illustrates binding a SteeringWheel component to a "Steer" axis and using both the SimpleInput API and direct component properties to control car steering and throttle in FixedUpdate. ```csharp using SimpleInputNamespace; using UnityEngine; public class CarController : MonoBehaviour { [SerializeField] private SteeringWheel wheel; private Rigidbody rb; void Awake() { rb = GetComponent(); // Bind wheel to a "Steer" axis wheel.axis.Key = "Steer"; } void FixedUpdate() { float steer = SimpleInput.GetAxis("Steer"); // -1..1 smoothed float throttle = SimpleInput.GetAxis("Vertical"); // Direct property reads (no axis lookup overhead) float rawSteer = wheel.Value; // -1..1 normalized float angle = wheel.Angle; // e.g. -87.3 degrees rb.AddRelativeTorque(Vector3.up * steer * 500f); rb.AddRelativeForce(Vector3.forward * throttle * 1500f); } } ``` -------------------------------- ### Control Unity Input Passthrough with SimpleInput.TrackUnityInput Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Shows how to control whether Unity's legacy Input system feeds values into SimpleInput. Set to false for pure virtual/touch-only input, or true to allow physical keyboard/mouse input. ```csharp using UnityEngine; public class InputModeManager : MonoBehaviour { void Start() { // Mobile-only: disable all physical keyboard/mouse passthrough SimpleInput.TrackUnityInput = false; } // Re-enable specific axes via UnityInputProvider component in the Inspector, // or re-enable globally: public void EnablePhysicalInput() { SimpleInput.TrackUnityInput = true; } } ``` -------------------------------- ### Rebind Joystick Axes and Read Input Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Demonstrates how to rebind joystick axes to custom input keys and read movement and aiming input using both the SimpleInput API and direct component value access. ```csharp using SimpleInputNamespace; using UnityEngine; public class JoystickSetup : MonoBehaviour { [SerializeField] private Joystick moveJoystick; [SerializeField] private Joystick aimJoystick; void Start() { // Rebind move joystick to custom axes moveJoystick.xAxis.Key = "MoveH"; moveJoystick.yAxis.Key = "MoveV"; // Rebind aim joystick aimJoystick.xAxis.Key = "AimH"; aimJoystick.yAxis.Key = "AimV"; } void Update() { // Read via SimpleInput API (axes are registered automatically) Vector2 move = new Vector2( SimpleInput.GetAxis("MoveH"), SimpleInput.GetAxis("MoveV") ); // Or read the normalised value directly from the component Vector2 aimRaw = aimJoystick.Value; // range -1..1 Debug.Log($"Move: {move} Aim: {aimRaw}"); } } ``` -------------------------------- ### SimpleInput.GetKey / GetKeyDown / GetKeyUp Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Polls the state of physical or virtual keys, similar to Unity's Input.GetKey* methods. Requires converting string inputs to KeyCode. ```APIDOC ## SimpleInput.GetKey / GetKeyDown / GetKeyUp ### Description Polls the state of physical or virtual keys, equivalent to Unity's `Input.GetKey*` methods. Note: there is no string overload; convert strings to `KeyCode` first. Both physical keys and virtual `KeyInput` providers contribute to the result. ### Usage Example ```csharp using UnityEngine; public class KeyInputExample : MonoBehaviour { void Update() { if (SimpleInput.GetKeyDown(KeyCode.Space)) Debug.Log("Space pressed"); if (SimpleInput.GetKey(KeyCode.LeftShift)) Debug.Log("Shift held"); if (SimpleInput.GetKeyUp(KeyCode.E)) Debug.Log("E released"); // Simulate a one-frame virtual key click from script SimpleInputHelper.TriggerKeyClick(KeyCode.E); // Map a mouse button to a key slot: // Add KeyInputKeyboard component with key = KeyCode.Mouse0 } } ``` ``` -------------------------------- ### Handle Button Input with SimpleInput Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Poll named buttons using `GetButtonDown`, `GetButton`, and `GetButtonUp` to detect transitions and held states, mirroring `Input.GetButton*` behavior. ```csharp using UnityEngine; public class JumpController : MonoBehaviour { private Rigidbody rb; void Awake() => rb = GetComponent(); void Update() { if (SimpleInput.GetButtonDown("Jump")) // true for exactly one frame rb.AddForce(Vector3.up * 8f, ForceMode.Impulse); if (SimpleInput.GetButton("Fire1")) // true every frame while held Debug.Log("Firing continuously..."); if (SimpleInput.GetButtonUp("Fire1")) // true for exactly one frame Debug.Log("Fire released"); } } ``` -------------------------------- ### Selective Physical Input with UnityInputProvider Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Re-enable specific Unity legacy axes, buttons, or keys when SimpleInput.TrackUnityInput is false. Configure desired inputs in the Inspector or programmatically. ```csharp // Usage is primarily via Inspector: // 1. Set SimpleInput.TrackUnityInput = false in code to block all physical input. // 2. Add a UnityInputProvider component to a persistent GameObject. // 3. In the Inspector, add "Horizontal" and "Vertical" to the Axes array // and "Jump" to the Buttons array to re-enable only those physical inputs. // Equivalent runtime setup: using SimpleInputNamespace; using UnityEngine; public class SelectivePhysicalInput : MonoBehaviour { void Awake() { // Block everything SimpleInput.TrackUnityInput = false; // Re-enable only "Horizontal" axis manually via a custom provider var axisInput = new SimpleInput.AxisInput("Horizontal"); axisInput.StartTracking(); SimpleInput.OnUpdate += () => { axisInput.value = Input.GetAxisRaw("Horizontal"); }; } } ``` -------------------------------- ### SimpleInput.GetMouseButton / GetMouseButtonDown / GetMouseButtonUp Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Mouse button polling by integer index (0 = left, 1 = right, 2 = middle), identical semantics to Input.GetMouseButton*. Virtual UI elements can also trigger mouse button states, enabling on-screen buttons that behave exactly like physical mouse clicks. ```APIDOC ## SimpleInput.GetMouseButton / GetMouseButtonDown / GetMouseButtonUp ### Description Mouse button polling by integer index (0 = left, 1 = right, 2 = middle), identical semantics to `Input.GetMouseButton*`. Virtual UI elements can also trigger mouse button states, enabling on-screen buttons that behave exactly like physical mouse clicks. ### Method `SimpleInput.GetMouseButton(int buttonIndex)` `SimpleInput.GetMouseButtonDown(int buttonIndex)` `SimpleInput.GetMouseButtonUp(int buttonIndex)` ### Parameters #### Path Parameters - **buttonIndex** (int) - Required - The index of the mouse button (0 for left, 1 for right, 2 for middle). #### Query Parameters None #### Request Body None ### Request Example ```csharp if (SimpleInput.GetMouseButtonDown(0)) Debug.Log("Left mouse button pressed"); if (SimpleInput.GetMouseButton(1)) Debug.Log("Right mouse button held"); if (SimpleInput.GetMouseButtonUp(2)) Debug.Log("Middle mouse button released"); ``` ### Response #### Success Response (200) - **bool** - True if the mouse button state matches the method called, false otherwise. #### Response Example ```json { "example": "true" } ``` ``` -------------------------------- ### Mouse Button Input and Virtual Clicks Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Use `GetMouseButtonDown`, `GetMouseButton`, and `GetMouseButtonUp` with integer indices (0=left, 1=right, 2=middle) for mouse button input. `SimpleInputHelper.TriggerMouseButtonClick` can simulate clicks programmatically. ```csharp using UnityEngine; public class MouseInputExample : MonoBehaviour { void Update() { if (SimpleInput.GetMouseButtonDown(0)) Debug.Log("Left mouse pressed this frame"); if (SimpleInput.GetMouseButton(1)) Debug.Log("Right mouse held"); if (SimpleInput.GetMouseButtonUp(2)) Debug.Log("Middle mouse released"); // Trigger a virtual left-click from code (e.g. from AI input) SimpleInputHelper.TriggerMouseButtonClick(0); } } ``` -------------------------------- ### SimpleInput.OnUpdate Event Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt A static event fired by the SimpleInput singleton at the beginning of each Update, before other MonoBehaviour Update calls. Subscribe custom input provider logic here. ```APIDOC ## SimpleInput.OnUpdate Event ### Description A static `UpdateCallback` event fired by the SimpleInput singleton at the beginning of each `Update`, before all other MonoBehaviour `Update` calls (via Script Execution Order). Subscribe custom input provider logic here instead of `MonoBehaviour.Update` to guarantee values are ready before gameplay code reads them. ### Usage Example ```csharp using UnityEngine; public class CustomAccelerometer : MonoBehaviour { public SimpleInput.AxisInput tiltX = new SimpleInput.AxisInput("Horizontal"); public SimpleInput.AxisInput tiltY = new SimpleInput.AxisInput("Vertical"); void OnEnable() { tiltX.StartTracking(); tiltY.StartTracking(); SimpleInput.OnUpdate += OnUpdate; // runs before gameplay Update } void OnDisable() { tiltX.StopTracking(); tiltY.StopTracking(); SimpleInput.OnUpdate -= OnUpdate; } void OnUpdate() { // Feed device accelerometer into virtual axes each frame tiltX.value = Input.acceleration.x * 2f; tiltY.value = Input.acceleration.y * 2f; } } ``` ``` -------------------------------- ### Trigger Virtual Button, Mouse Button, or Key Presses Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Simulate one-frame virtual presses for buttons, mouse buttons, or keys from script without a persistent input provider. Useful for tutorials, AI, or automated tests. ```csharp using UnityEngine; public class TutorialManager : MonoBehaviour { void DemoJump() { // Simulates a one-frame "Jump" button press — GetButtonDown will be true next frame SimpleInputHelper.TriggerButtonClick("Jump"); } void DemoLeftClick() { // Simulates a one-frame left mouse button click SimpleInputHelper.TriggerMouseButtonClick(0); } void DemoReload() { // Simulates a one-frame KeyCode.R key press SimpleInputHelper.TriggerKeyClick(KeyCode.R); } } ``` -------------------------------- ### SimpleInput.TrackUnityInput Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt A static boolean property to control whether Unity's legacy Input system feeds values into SimpleInput. Set to false for pure virtual/touch-only input. ```APIDOC ## SimpleInput.TrackUnityInput ### Description Static boolean property that controls whether Unity's legacy `Input` system feeds values into SimpleInput. Set to `false` for pure virtual/touch-only input (e.g., mobile games where physical keyboard should be ignored); re-enable selectively per-axis via the `UnityInputProvider` component. ### Usage Example ```csharp using UnityEngine; public class InputModeManager : MonoBehaviour { void Start() { // Mobile-only: disable all physical keyboard/mouse passthrough SimpleInput.TrackUnityInput = false; } // Re-enable specific axes via UnityInputProvider component in the Inspector, // or re-enable globally: public void EnablePhysicalInput() { SimpleInput.TrackUnityInput = true; } } ``` ``` -------------------------------- ### SimpleInput.GetAxis / GetAxisRaw Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Returns the smoothed (GetAxis) or instantaneous raw (GetAxisRaw) float value for a named axis. These methods mirror Unity's Input.GetAxis and Input.GetAxisRaw. Smoothing is configurable via SimpleInput.GetAxisSensitivity, SimpleInput.GetAxisDeadZone, and SimpleInput.GetAxisSnapValue. ```APIDOC ## SimpleInput.GetAxis / GetAxisRaw ### Description Returns the smoothed (`GetAxis`) or instantaneous raw (`GetAxisRaw`) float value for a named axis, exactly mirroring `Input.GetAxis` / `Input.GetAxisRaw`. Smoothing is driven by `SimpleInput.GetAxisSensitivity` (lerp modifier, default 20) and snaps through zero when direction reverses if `SimpleInput.GetAxisSnapValue` is `true`. ### Method `SimpleInput.GetAxis(string axisName)` `SimpleInput.GetAxisRaw(string axisName)` ### Parameters #### Path Parameters - **axisName** (string) - Required - The name of the input axis. #### Query Parameters None #### Request Body None ### Request Example ```csharp float h = SimpleInput.GetAxis("Horizontal"); float hRaw = SimpleInput.GetAxisRaw("Horizontal"); ``` ### Response #### Success Response (200) - **float** - The value of the input axis. #### Response Example ```json { "example": "0.73" } ``` ### Configuration Properties - **SimpleInput.GetAxisSensitivity** (float) - Controls the speed of smoothing for `GetAxis`. Default is 20. - **SimpleInput.GetAxisDeadZone** (float) - The threshold below which axis values are treated as zero. Default is 0. - **SimpleInput.GetAxisSnapValue** (bool) - If true, `GetAxis` will snap through zero when the direction reverses. ``` -------------------------------- ### SimpleInput.GetButton / GetButtonDown / GetButtonUp Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Polls a named virtual button, mirroring the three Input.GetButton overloads. These methods return true on the frame the button transitions to held (Down), while it remains held (GetButton), and the frame it is released (Up). ```APIDOC ## SimpleInput.GetButton / GetButtonDown / GetButtonUp ### Description Polls a named virtual button, mirroring the three `Input.GetButton*` overloads. Returns `true` on the frame the button transitions to held (`Down`), while it remains held (`GetButton`), and the frame it is released (`Up`). ### Method `SimpleInput.GetButton(string buttonName)` `SimpleInput.GetButtonDown(string buttonName)` `SimpleInput.GetButtonUp(string buttonName)` ### Parameters #### Path Parameters - **buttonName** (string) - Required - The name of the input button. #### Query Parameters None #### Request Body None ### Request Example ```csharp if (SimpleInput.GetButtonDown("Jump")) Debug.Log("Jump button pressed"); if (SimpleInput.GetButton("Fire1")) Debug.Log("Fire button held"); if (SimpleInput.GetButtonUp("Fire1")) Debug.Log("Fire button released"); ``` ### Response #### Success Response (200) - **bool** - True if the button state matches the method called, false otherwise. #### Response Example ```json { "example": "true" } ``` ``` -------------------------------- ### Attach ButtonInputUI to UI Elements Source: https://context7.com/yasirkula/unitysimpleinput/llms.txt Attach this component to a UI Graphic element to fire a named virtual button when the element is held. Ensure the button's Key is set either in the Inspector or at runtime. ```csharp using SimpleInputNamespace; using UnityEngine; // Attach ButtonInputUI to a UI Image/Button GameObject in the Inspector. // Set button.Key = "Jump" in the Inspector or at runtime: public class ButtonSetup : MonoBehaviour { [SerializeField] private ButtonInputUI jumpButton; [SerializeField] private ButtonInputUI fireButton; void Start() { jumpButton.button.Key = "Jump"; fireButton.button.Key = "Fire1"; } } // Elsewhere in gameplay code — no reference to ButtonInputUI needed: public class PlayerActions : MonoBehaviour { void Update() { if (SimpleInput.GetButtonDown("Jump")) Debug.Log("Jump triggered by on-screen button"); if (SimpleInput.GetButton("Fire1")) Debug.Log("Firing..."); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.