๐Ÿ”ŒComponents

In this section we will learn about the core components.

Overview

After the previous step, these components had been added to our character:

Components.

FPS Animator

It is a central hub component, which controls the flow of all entities in the framework, by initializing, updating, and disposing of other components.

FPS Bone Controller

This component applies procedural animation features. It does not have any special properties, hence there is no special setup for this component.

User Input Controller

The FPS Animation Framework introduces a standalone input property system. The idea is that you can define custom properties in the Input Config asset and use them in runtime:

This asset contains your custom properties.

This system is used to establish communication between the framework entities and your project codebase.

User Input Controller allows you to work with the property system, by getting or setting the values:

Specify the input asset.

Playables Controller

This component controls how Animation Clips are played in runtime. It uses Unity Playables API to add custom animation layers, that allow you to play animations right from code.

Create a new Avatar mask, select the upper body bones, and assign it to this component:

Playables Controller inspector.

Your upper body mask needs to be adjusted to play custom animations. To do this, go to Window/FPS ANIMATOR/Tools/Avatar Mask Modifier. Now we need to add the WeaponBone object to the avatar mask. Specify the Root and the Upper Body Mask:

Press the Add Bone button.

The Playables Weight Property is used to control the influence of the Playbles Controller. You can specify here any float value from the input system, but it is recommended to leave the PlayablesWeight as a default value.

You can also use this component to preview animations in the editor. Just select your animations and hit the preview button!

Execution order

Lastly, we need to adjust the Script Execution Order in the Project Settings. Go to the Edit/Project Settings/Script Execution Order and make sure to put the FPS Animator after your controller class:

FPSController can be your controller class, where you use the FPS Animator component.

It is also important to initialize the FPS Animator component in the controller. This can be done by calling the Initialize() method:

ExampleController.cs
private void Start()
{
    _fpsAnimator = GetComponent<FPSAnimator>();
    _fpsAnimator.Initialize();
}

At this point, the character setup is complete. In the next section, we will learn about the procedural animation assets.

Last updated