# 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="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2F5OeN95bBu3zP3AHIdhag%2FMost%20control%201s.gif?alt=media&#x26;token=de1257b1-6152-45a7-89fa-c6dd429f9504" alt=""><figcaption><p>Multiply_1 Template on real device</p></figcaption></figure>

<figure><img src="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2Fodbnn6chiCBnd2rcvvNq%2FMultiply_1ss.png?alt=media&#x26;token=9d9560b7-7bea-483a-a89e-65f316df12a5" 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="https://content.gitbook.com/content/XVjqyL2Am4WC7AkXSTxy/blobs/XBMA1smgvvTFFAhkNGHl/multi%20socrce.gif" 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="https://content.gitbook.com/content/XVjqyL2Am4WC7AkXSTxy/blobs/HY3KhbuhmmELwP6ioFgA/jOYS%20TEST.gif" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/XVjqyL2Am4WC7AkXSTxy/blobs/voxHJAGBhD07ZD8N65JD/Buttontest.gif" alt=""><figcaption></figcaption></figure>

* **Buffer Control (Time Buffer)**

<figure><img src="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2FSXjI4ZOKUxMOWIZWegK1%2FMost%20control%2014.gif?alt=media&#x26;token=b16e697e-8df4-4f23-80d7-d7dc5f80ab41" alt=""><figcaption></figcaption></figure>

* **Charged controllers**

<figure><img src="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2FMpEfbLnpmchDABlej0CD%2FMost%20control%2013.gif?alt=media&#x26;token=06c01bba-0b41-4e19-97c5-749cd00ceddf" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2FXLLffJEKW4LPQmbqnQN9%2FScreenshot%202025-05-14%20at%207.39.21%E2%80%AFAM.png?alt=media&#x26;token=b350bd8c-c339-44fc-8f8f-bf0ba516d2f4" 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="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2Fs5u9fmXH3mmjNLpzoDmr%2FScreenshot%202025-05-14%20at%207.22.40%E2%80%AFAM.png?alt=media&#x26;token=fafc6898-1dc9-44bf-87de-1443aefea4f7" 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="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2F0uJsGwaZkx6E0oNqQKvG%2FScreenshot%202024-10-24%20at%209.42.43%E2%80%AFAM.png?alt=media&#x26;token=4dd76353-dd09-436d-80c6-9099f5d88466" alt=""><figcaption><p>Button (all types) Event System </p></figcaption></figure>

<figure><img src="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2FW7zSOx1gHRnPT9jqb8tO%2FScreenshot%202024-10-24%20at%209.42.11%E2%80%AFAM.png?alt=media&#x26;token=77a5d15b-7864-4d39-8c80-51f9ba864457" alt=""><figcaption><p>Static joystick event system</p></figcaption></figure>

<figure><img src="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2FkO7VUqujSPhFQk5AKygQ%2FScreenshot%202024-10-24%20at%209.42.31%E2%80%AFAM.png?alt=media&#x26;token=e099e12b-9637-4c55-b191-83af2e14dcf7" 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="https://1720637334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVjqyL2Am4WC7AkXSTxy%2Fuploads%2FkuSFhCAUJtDFDRgSFX5o%2FScreen%20Recordin%20at%209.39.29%E2%80%AFAM.gif?alt=media&#x26;token=3fa7e9e6-55a3-403f-b290-1736d57764c5" 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-free-move)<mark style="color:purple;">**,**</mark>**&#x20;**<mark style="color:blue;">**and**</mark> [<mark style="color:purple;">**MOST Grid Move**</mark>](most-grid-move)


{% 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
```



