Animator Override Controllers Learning and performance testing

Source: Internet
Author: User

The Animator Override controller is a type of asset which allows a extend existing controller, Animator The specific animations used but otherwise retaining the original ' s structure, parameters and logic.

An animated overlay is a class of asset that allows you to expand an existing animation controller, using a specific animations but preserving the original structure, parameters, and logic;

This allows-to-create multiple variants of the same basic state machine, if with each using different sets of Animati Ons.

This allows you to create multiple variants of the same basic state machine, which use different animations

For example, your game could have a variety of NPCs types living in the world, but each type (Goblin, Ogre, Elf, etc) has the IR own unique animations for walking, idling, sitting, etc.

For example: You have a series of NPCs live in the game, they have their own unique walk, idle, waiting for animations;

By creating one ' base ' Animator Controller containing the logic for all NPCs types, you could then create a override for E Ach type and drop in their respective animation files.

To demonstrate, here's a typical Animator Controller asset:

Create a base animation controller that contains the logic of all kinds of NPCs, and you can create an override for each NPC and then fill it with their respective animation;

usingUnityengine;usingSystem.Collections; Public classAnimatoroverideperformance:monobehaviour { Public BOOLM_test =true; Animator M_animator=NULL; Animatoroverridecontroller M_old=NULL; Animatoroverridecontroller m_new=NULL; //Use this for initialization    voidStart () {M_animator= getcomponent<animator>(); M_old=NewAnimatoroverridecontroller (); M_new= Resources.load<animatoroverridecontroller> ("packages/artworks/player/m2/m2_p04/m2_p04");        Debug.logerror (m_new); M_old=(Animatoroverridecontroller) M_animator.runtimeanimatorcontroller; if(NULL!=m_new) {Debug.logerror (m_old["p01attack01"]); Debug.logerror (m_old["p01attack02"]); m_old["p01attack01"] = m_new["p04attack01"]; m_old["p01attack02"] = m_new["p04attack02"]; Debug.logerror (m_old["p01attack01"]); Debug.logerror (m_old["p01attack02"]); }            }    voidUpdate () {profiler.beginsample ("Update"); if(M_test &&m_new) {Profiler.beginsample ("this[]"); m_old["p01attack01"] = m_new["p04attack01"]; m_old["p01attack02"] = m_new["p04attack02"];        Profiler.endsample ();    } profiler.endsample (); }    }

One-time consumption of about 0.5 to 1ms

Animator Override Controllers Learning and performance testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.