# Linking

## Overview

The linking process is used to smoothly blend in our desired Animator Profile in runtime.&#x20;

Let's take at the linking functionality in the source code:

```csharp
public void UnlinkAnimatorProfile() { ... }
public void LinkAnimatorProfile(GameObject itemEntity) { ... }
public void LinkAnimatorProfile(FPSAnimatorProfile newProfile) { ... }
```

The system has a way to link a Game Object, if it contains the Animator Profile. This is only possible if your Game Object has an **FPSEntityComponent**:

<figure><img src="/files/5oSA635HwDTY2KpepBDX" alt="" width="350"><figcaption></figcaption></figure>

Then, in your controller code, you can just pass the weapon Game Object to the **LinkAnimatorProfile** method, and it will work as expected.

The **UnlinkAnimatorProfile** is used to blend out the currently active profile, which might be useful when you do not want to use the system at all.

## Code example

Let's see how we can apply the linking in practice. Here's a code snippet from the demo:

{% code title="Weapon.cs" %}

```csharp
public override void OnEquip(GameObject parent)
{
    ...
    _fpsAnimator.LinkAnimatorProfile(gameObject);
    ...
}
```

{% endcode %}

In the demo project, weapons control the equipment logic, and because our weapon has an **FPS Animator Entity** component, we can just pass the gameObject as a parameter.

It is also possible to link individual layers:

{% code title="Weapon.cs" overflow="wrap" %}

```csharp
public override void OnUnEquip()
{
    _fpsAnimator.LinkAnimatorLayer(unEquipMotion);
}
```

{% endcode %}

In this example, we play a procedural unequip animation by dynamically linking an **`unEquipMotion`**.

***

In the next section, we will learn how to integrate animation framework components with a third-party controller.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kinemation.gitbook.io/scriptable-animation-system/workflow/linking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
