# Malbers Input & MInput

## Overview

This is the Input Source for all the animals and creatures. This will send the Inputs values to the Animal. When using the Animals for AI you don’t need to add this script since the AI will handle the Movement and other Logic

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F8mwqeBM7lqyvxbtRHOXb%2Fimage.png?alt=media&#x26;token=d855bc07-95e1-4183-9350-2a55b2fa2062" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The Different between **Malbers Input** and **MInput** is that the last one does not have any Axis (***Horizontal***, ***Vertical*** and ***UpDown***). **MInput** is used only when the Movement Axis are handled by an external component.
{% endhint %}

{% hint style="success" %}
When Using the[ **Riding System**](https://malbersanimations.gitbook.io/animal-controller/riding/hap-riding-system) this component must be **Disabled.** Otherwise the animal will move as soon as you press any of the **Inputs** and we don’t want to start moving when the rider is NOT mounted.
{% endhint %}

## Parameters:

### **Horizontal/Vertical Axis/UpDownAxis:** &#x20;

These are Inputs from the Unity Input System (Horizontal and Vertical are created by default). Custom Advanced Third Person Controller(TPC)  Uses their own Input values. You can easily change it here to match the inputs from those TPC.<br>

### **Inputs Field**

This are the Inputs used to activate any logic you need from any Component. They use the `iMalbersInputs` interface to communicate with the Animal Script. If you are using a custom input system just change the **type** to **Input** and use the  same **Input Value** on the Unity Input System.

## Input Field (InputRow) Parameters:

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-LzwP4UGs9jgBNFCdJDM%2F-LzwVQNK16YKmi3DNVf4%2Fimage.png?alt=media\&token=06cad6df-228f-4faf-aef9-674fc7dca3f6)

### Active

Is the little checkbox near the name. It will enable and disable the input.

### Name

Name of the Input. It is used on the [States](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/states), and [Modes ](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/modes)to Identify who's the input that will activate their logic.

### Type

Type of the Field... which you can choose between "Key" or "Unity Input".

### Value

Value of the Input. If the Type is **Key** you can pick a Key Code. If the type is **Input**

### Button

Logic of the Input you want to use

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FplNnsZm1fQOStZJnZsZW%2Fimage.png?alt=media&#x26;token=cdd1c559-3cf1-419e-9b57-c12d95121632" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Select an **Input Field** and you will access their **Events** and **Properties**\
**This is the same for MInput and Malbers Input**
{% endhint %}

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-LzwP4UGs9jgBNFCdJDM%2F-LzwZ67kjpW3hXzA4dzE%2FZOufXJGXHR.gif?alt=media\&token=1928e8e6-715f-445d-ab02-4b7e9c8cc4df)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FehYIWpA0jOuY5Aw3BGL3%2Fimage.png?alt=media&#x26;token=253adfbd-fd98-4466-95c2-0ed3d9ae131e" alt=""><figcaption></figcaption></figure>

#### Press

The Input will Register 2 Events: **On Input Pressed()** and **On Input Changed(boolean).**

* **On Input Pressed:** Is invoked every time the Key/Input is Pressed
* **On Input Changed:** Invoke **true** when the Key/Input is Down and **false** when the Key/Input is released

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-LzwP4UGs9jgBNFCdJDM%2F-LzwXunuC-39iZoX8H1F%2Fimage.png?alt=media\&token=9f2ef6ed-efe9-447c-90e5-67f6e40b1cb1)

#### Down

The Input will Register 2 Events: **On Input Down()** and **On Input Changed(boolean).**

* **On Input Down:** Is invoked when the Key/Input is Down
* **On Input Changed:** Invoke **true** when the Key/Input is Down and **false** when the Key/Input is released.

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-Lzwb45T-f--lT31vFlD%2F-LzwelPJxHjB1_1k9mFB%2Fimage.png?alt=media\&token=a0c1752b-9ac6-4901-859b-f6fd2c7e5090)

#### Up

The Input will Register 2 Events: **On Input Up()** and **On Input Changed(boolean).**

* **On Input Up:** Is invoked when the Key/Input is Released
* **On Input Changed:** Invoke **true** when the Key/Input is Down and **false** when the Key/Input is released.

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-Lzwb45T-f--lT31vFlD%2F-LzwegsH1I2QYhArpQUN%2Fimage.png?alt=media\&token=578c6493-7a94-410f-b1ee-973bf15130ca)

#### Long Press

* **Long Press Time:** Time required to do the long Input/Key press.

The Input will Register 4 Events:

* **On Long Press:** Is invoked the Long Press time ends.
* **On Pressed Time Normalized:** Invoke a normalized value from 0 to 1 every frame the Key/Input is pressed during the **Long Press Time**.
* **On Pressed Down:** Is invoked when the Key/Input is Down the first time.
* **On Pressed Interrupted:** Is invoked when the Key/Input is released before the Long Press time ends

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-Lzwb45T-f--lT31vFlD%2F-Lzwe6biE1MVg8-9HY7z%2Fimage.png?alt=media\&token=4c800912-51a3-440d-8105-e4d62a94668a)

#### **Double Tap**

* **Double Tap time:** Valid Time between the first input and the second input to be consider a Double Tap.

The Input will Register 2 Events: **On First Tap()** and **On Double Tap().**

* **On First Tap:** Is invoked on the First Input/Key Down.
* **On Second Tap:** Is invoked if the First Input/Key Down is pressed again withing the **Double Tap Time** value.

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-LzwZXQk2P4A0TA5eZSu%2F-LzwZtOrkpkumc76pMdW%2Fimage.png?alt=media\&token=fdcdb9c4-3371-4e35-aafd-b34d06879fd3)

#### Toggle

The input will register 3 events: **On Input Toggle(), On Toggle On()** and **On Toggle Off()**

* **On Input Toggle:** Is invoked every-time the key is pressed. Switches between Toggle On/Off.
* **On Toggle On:** Is invoked when the toggle is set to On.
* **On Toggle Off:** Is invoked when the toggle is set to Off.

#### Axis

The Input will register 5 events: **On Axis Value Changed, On Input Changed, On Input Pressed, On Input Down, On Input Up**

* **On Axis Value Changed:** is invoked when the axis value changes
* **On Input Changed**: is Invoked when the input value has changed e.g. Invoke **true** when the Key/Input is Down and **false** when the Key/Input is released
* **On Input Pressed**: is invoked every time the input is pressed
* **On Input Down**: is invoked every time the input is pressed down
* **On Input Up**: is invoked every time the input is released after being pressed down

## Events

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FCmlsx3BOMw74qMcv0dn8%2Fimage.png?alt=media&#x26;token=8b01ee4e-888d-4c48-a139-9f2b7d39533a" alt=""><figcaption></figcaption></figure>

### On Input Enabled

Invoked when the component is Enabled.

### On Input Disabled

Invoked when the component is Disabled.

### Movement Event

Invoke the Vector3 value combined of the Horizontal, Vertical and UpDown Inputs.

## Gamepad connection

If you are using Malber Input component, First change all the Input Type to Input:

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FhUgVd9E7edhh5GQMH3En%2FUnity_1iJhAb88rO.gif?alt=media&#x26;token=d0953413-7c97-4fb1-9c2a-b0af732e3f27" alt="" width="506"><figcaption></figcaption></figure>

Add all the necessary inputs to map your Gamepad on The Project settings.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FFZNSQYLQesXQAlBfP7Dc%2Fimage.png?alt=media&#x26;token=0e3b7325-783c-4531-a42c-394a05044624" alt="" width="563"><figcaption></figcaption></figure>

Here's an image for reference for connecting a gamepad to the Old Input System

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FHXTe0uGoNMGPtQ53TAwh%2Fimage.png?alt=media&#x26;token=4ededbe0-1936-4066-85b7-67442205c3b4" alt=""><figcaption></figcaption></figure>

The value of the input must match on the project settings and the component

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FY7FNBiF9Z7jG3LmacBJz%2Fimage.png?alt=media&#x26;token=c1ed955f-f8ea-4110-a15e-36804e6b53ce" alt=""><figcaption></figcaption></figure>

To be honest, when using multiple controllers I strongly recommend using  [**Rewired**](https://malbersanimations.gitbook.io/animal-controller/annex/integrations/rewired) \
\
It is the most stable and most used system for multiple controller types

The other alternative is the [**New Input System**](https://malbersanimations.gitbook.io/animal-controller/annex/integrations/unity-input-system-new/new-input-link-old-versions)
