> For the complete documentation index, see [llms.txt](https://solo-player.gitbook.io/most-in-one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://solo-player.gitbook.io/most-in-one/most-systems/most-controller.md).

# MOST Controller

The best solution for mobile input controllers and supporting keyboard keys\
all possible variations of Custom buttons and joysticks with multiple input source support

<figure><img src="/files/DYMV4Wu4l8TinCqAOymq" alt=""><figcaption><p>Multiply_1 Template on real device</p></figcaption></figure>

<figure><img src="/files/yvb8KiMX6Mpuin37hum8" alt=""><figcaption><p>each controller activation area marked by it's color</p></figcaption></figure>

## <mark style="color:red;">Import MOST Controller</mark>

**1- Create an empty object on your UI Canvas (will become the controller... Button, Joystick.....)**

**2- Select this object and tap Add Component**

**3- select Most\_Control.cs**

**4- Modify the controller properties as they fit your vision and done... You have an input controller**

> * <mark style="color:blue;">**The Controller system is only one .cs file contains all UI Input controllers (all types of Buttons + all types of joysticks + swipes)**</mark>
> * <mark style="color:blue;">**You will find examples for most common controller variations and how to use it**</mark>
> * <mark style="color:blue;">**The target UI Sprite object can be used in multiple controllers like use it to get inputs from screen (one controller) and keyboard (another controller), see examples below**</mark>

## <mark style="color:red;">Features</mark>

* Using Most\_Controller you can create all possible variations of Custom buttons and joysticks
* Support Multiple input sources in one controller

<figure><img src="/files/lSnh3PsNzD8cEKs6Q9EX" alt=""><figcaption><p>the joystick controlled by touch and axis buttons from keyboard and button controlled by touch and X button (multi input source) </p></figcaption></figure>

* Support multitouch in the MOST efficient way
* Support all mobile devices and all custom keyboard inputs
* Support Swipes, Hover triggers, and custom zones
* Complete debug system and all state output detections

<figure><img src="/files/vlmnTG3MEH8jsJrcevT0" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/uu4SOr7PK5r1vr4q6Fdo" alt=""><figcaption></figcaption></figure>

* **Buffer Control (Time Buffer)**

<figure><img src="/files/Z8b9pLPmKwuMMhxUM0Lj" alt=""><figcaption></figcaption></figure>

* **Charged controllers**

<figure><img src="/files/IAXfjyIv0gvCPoc8AYi5" alt=""><figcaption></figcaption></figure>

* Advanced UI Img/Color and a lot of "ready-to-use" effects

<figure><img src="/files/xp02gvsthiUYQka9jwIN" alt=""><figcaption></figcaption></figure>

* Live Output

You can see all controller output data directly from the inspector, or use get functions to get any data you're looking for. Check the API section

<figure><img src="/files/SJsYXjT9sbAVeEOC04Ft" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}

* <mark style="color:blue;">**All output can be accessed using .cs calls or event systems**</mark>
* <mark style="color:blue;">**If Output refers to a value, the event system will send this value to the attached functions.**</mark> \ <mark style="color:orange;">**for example,**</mark>**&#x20;**<mark style="color:blue;">**On Direction change event will send the new direction value**</mark>
* <mark style="color:blue;">**You will find all output values next to the Event brackets**</mark>
  {% endhint %}

## <mark style="color:red;">All Events</mark>

<figure><img src="/files/3SdhdjnQ0YRvGfdQWK2L" alt=""><figcaption><p>Button (all types) Event System </p></figcaption></figure>

<figure><img src="/files/xSqPI4pbBUCvjbUC8Evi" alt=""><figcaption><p>Static joystick event system</p></figcaption></figure>

<figure><img src="/files/vSCsTydEYvn2E9UCbtVs" alt=""><figcaption><p>Dynamic JoyStick Event system</p></figcaption></figure>

## <mark style="color:red;">Raw Output</mark>

What is Raw output? the distance in vector between the joystick knob center position and the max position that Knob can reach

Raw output used for? Or examples?

Note: when Knob is close to the center the throw aim sprite disappears \
(This is an optional setting on the controller "Min Activation Range")

<figure><img src="/files/Ns09v44x2Klki1ZqGIHn" alt="" width="462"><figcaption></figcaption></figure>

{% hint style="success" %} <mark style="color:green;">**Is there a Direction snap system?**</mark>

<mark style="color:blue;">**Yes, and it's very simple to set up. There is a drop-down menu for the 4, 8, and Free direction snap system you can select from, and then the system output will snap directly.**</mark>

<mark style="color:blue;">**You will find examples for all of MOST Movement systems (Move, Grid Move) using direction snap, Check**</mark> [<mark style="color:purple;">**MOST Free Move**</mark>](/most-in-one/most-systems/most-free-move.md)<mark style="color:purple;">**,**</mark>**&#x20;**<mark style="color:blue;">**and**</mark> [<mark style="color:purple;">**MOST Grid Move**</mark>](/most-in-one/most-systems/most-grid-move.md)

{% endhint %}

## <mark style="color:red;">API reference</mark>

{% hint style="success" %} <mark style="color:green;">**All public properties can be updated at runtime, and the changes will be set immediately.**</mark>
{% endhint %}

```csharp

// Output Functions
// main behavior enables or disables the controller
Most_Controller.EnableState(bool Enable);

// return the current direction of this controller in Vector2
Most_Controller.GetAxis(); return Vector2;

// return the current joystick Knob magnitude scale in float scaled (0,1)
Most_Controller.GetMagnitude(); return float;

// return the current joystick Knob position scale in float scaled (0,1)
Most_Controller.GetRawValue(); return Vector2;

// return the last detected swipe direction
Most_Controller.GetSwipeDirection(); return Vector2;

// Call this function to start a time buffer or charge (reset charge to 0)
// Depending on the selected buffer system
// bool exeeded must be true to start buffer
Most_Controller.StartBuffer(bool exeeded)

// Charge controller function
// The charger (from 0 to 100) value will be increased or decreased by "amount"
Most_Controller.ChargeBuffer(float amount)

//_______________________________________________________________//

// Check if this controller is receiving a touch input
Most_Controller.isTouched return bool

// Check if this controller is active or not
// same as GetMagnitude() value > 0;
Most_Controller.ExeedMinRange return bool

// Enable or disable or check if Touch input is enabled or not
Most_Controller.EnableTouch return or set bool

//Enable or disable or check if button input is enabled or not
Most_Controller.EnableButtons return or set bool

//Enable or disable or check if swipe control is enabled or not
Most_Controller.EnableSwipe return or set bool

//The distance from the center that has to be passed to enable OnExceedMinRange() 
// and return to enable OnReturnMinRange()
Most_Controller.KnobMinActiveRange return or set float

// The max Range of the Knob UI controller
Most_Controller.KnobMaxRange return or set float

// The touch scale to trigger a swipe
Most_Controller.SwipeSinstivity return or set float

// The enable time between start and end touch to enable swipe 
// Exceeding this time means this touch is not a swipe
Most_Controller.SwipeDisableDelta return or set float

// CoolDown time in seconds
Most_Controller.BufferTime return or set float
```
