# AddInput<U, V>(U, V, int, float)

> Create a new input port and connect it to the output port of the given Playable.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Playables](/engine/6000.6/script-reference/unityengine/playables.md)
* **Assembly:** UnityEngine.CoreModule

## AddInput\<T, U>(T, T, int, float)

```csharp
public static int AddInput<U, V>(this U playable, V sourcePlayable, int sourceOutputIndex, float weight = 0) where U : struct, IPlayable where V : struct, IPlayable
```

### Parameters

**** (T): The [Playable](/engine/6000.6/script-reference/unityengine/playables/playable.md) used by this operation.**** (T): The [Playable](/engine/6000.6/script-reference/unityengine/playables/playable.md) to connect to.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The output port of the [Playable](/engine/6000.6/script-reference/unityengine/playables/playable.md).**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The weight of the created input port.

### Returns

| Type                                                       | Description                                |
| ---------------------------------------------------------- | ------------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the newly created input port. |

### Remarks

If several inputs are needed, it is better to use [PlayableExtensions.SetInputCount](/engine/6000.6/script-reference/unityengine/playables/playableextensions/setinputcount.md) and [PlayableExtensions.ConnectInput](/engine/6000.6/script-reference/unityengine/playables/playableextensions/connectinput.md).

This method is a mere helper on top of [PlayableGraph.Connect](/engine/6000.6/script-reference/unityengine/playables/playablegraph/connect.md).

Use this templated extension method on any type that inherits from [IPlayable](/engine/6000.6/script-reference/unityengine/playables/iplayable.md).
