arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Legacy vs. Modern Animation System

Understanding the difference between the two systems, and which might be the right one for you.

hashtag
Intro to the Animation Systems

hashtag
Legacy Animation System

The legacy animation system uses Unity's Animation component and Anything World's LegacyAnimationController component which blends between the different animation clips depending on parameters and function calls by the developer. It is primarily used when an object is being created at runtime and requires a transition between multiple animations.

hashtag
Modern Animation System

The modern animation system uses Unity's own Animator component. This solution serializes all of the animation components and uses an Animator Override Controller to structure the transition links and parameters, which come together to make a fully structure animator. This system cannot be used at runtime, and requires you to have created the override controller in editor mode.

hashtag
Pros & Cons

hashtag
Legacy Animation System

Pros
Cons

hashtag
Modern Animation System

Pros
Cons

hashtag
Using the systems

hashtag
Legacy Animation System

To use the legacy animation system in editor, you can pass into your call as a . Doing so tells the Anything World system to use the legacy animation system rather than the modern animation system. At runtime, the system will automatically default to creating an object using the legacy animator.

A created object, depending on its typing will come with a different legacy animation controller. Most animals by default are created with the , whereas flying birds are created with the .

hashtag
Example

hashtag
Modern Animation System

Anything World uses the modern animation system by default for any objects that are created in editor. As this system uses the built-in Unity animator, you can use their to modify and read from the controller created.

Can be created both in Editor Mode and Play Mode

Is not directly compatible with the traditional animator

Simple to transition between different states

More rigid, as the legacy animation controllers strictly follow the animation state transitions set up on the object being loaded

Naturally integrates into the already existing systems in Unity

Can only be created in Editor Mode

Can be modified after creation through the created Animator Controller

Requires serialization, which could increase application build size

LegacyAnimatorInEditorOption(true)
AnythingMaker.Make()
RequestParameter
RunWalkIdleController
FlyingAnimationController
scripting APIarrow-up-right
using UnityEngine;
using AnythingWorld.Animation;

public class ExampleClass : MonoBehaviour
{
    public float speed = 0.0167f;
    private float velocity;

    private GameObject createdGameObject;
    private RunWalkIdleController controller;

    public void Start()
    {
        createdGameObject = AnythingMaker.Make("Cat", RequestParameter.UseLegacyAnimatorInEditor(true));
    }

    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.W)) velocity += speed;
        if (Input.GetKeyDown(KeyCode.S)) velocity -= speed;
        velocity = Mathf.Clamp(velocity, 0, speed * 2);

        if (controller == null)
        {
            controller = createdGameObject.GetComponentInChildren<RunWalkIdleController>();
        }
        else
        {
            controller.walkThreshold = 0;
            controller.runThreshold = speed;
            createdGameObject.transform.Translate(0, 0, velocity);
            controller.BlendAnimationOnSpeed(velocity);
        }
    }
}