本文由博主(YinaPan)原创,转载请注明出处:http://www.cnblogs.com/YinaPan/p/Unity_AnimatorOverrideContorller.html 

The Animator Override Controller is a type of asset which allows you to extend an existing Animator Controller, replacing the specific animations used but otherwise retaining the original’s structure, parameters and logic.

动画覆盖器是一类asset,它允许你扩张已经存在的动画控制器,用特定的animations 但是需要保留原始的结构、参数和逻辑;

This allows you to create multiple variants of the same basic state machine, but with each using different sets of animations.

这就允许你创建同一个基础状态机的多个变种,这些变种使用不同的animations

For example, your game may have a variety of NPC types living in the world, but each type (goblin, ogre, elf, etc) has their own unique animations for walking, idling, sitting, etc.

例如:你有一系列的npc生活在游戏中,他们有自己的独特走、idle、坐等animations;

By creating one “base” Animator Controller containing the logic for all NPC types, you could then create an override for each type and drop in their respective animation files.

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

创建一个基础动画控制器,包含所有种类npc的逻辑,你就可以创建一个override为每一种NPC,然后用他们各自的animation去填充;

using UnityEngine;
using System.Collections; public class AnimatorOveridePerformance : MonoBehaviour {
public bool m_test = true;
Animator m_animator = null;
AnimatorOverrideController m_Old = null;
AnimatorOverrideController m_New = null; // Use this for initialization
void Start () {
m_animator = GetComponent<Animator>();
m_Old = new AnimatorOverrideController();
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"]);
}
} void Update() {
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();
} }

单次消耗大概在0.5到1ms

Animator Override Controllers 学习及性能测试的更多相关文章

  1. Animator Override Controller学习及性能测试

    本文由博主(YinaPan)原创,转载请注明出处: http://www.cnblogs.com/xsln/p/Animator_Override_Controller.html 一.Animator ...

  2. 如何学习LoadRunner性能测试?

    最近组内同事针对性能测试LR的脚本部分做了介绍,是个不错的分享.会后反思自己也有很长一段时间没做性能测试了,根据以往的经验,有必要做些整理和补充,本文主要介绍一些Loadrunner性能测试的学习方法 ...

  3. JMeter学习-030-JMeter性能测试常用之事务控制器实例

    通常进行性能测试时,我们一般仅考虑主要的数据返回,不考虑页面渲染所需要的数据(例如:css.js.图片等).但当我们需要衡量打开一个页面(页面渲染完成)的性能时,我们就需要考虑完成页面渲染所需要的图片 ...

  4. httprunner学习16-locust性能测试

    前言 HttpRunner 的 yaml 脚本文件,可以结合locust做性能测试 locust环境准备 安装完成 HttpRunner 后,系统中会新增locusts命令,但不会同时安装 Locus ...

  5. JMeter学习笔记--性能测试理论

    一.性能测试技能树 二.性能测试流程 三.性能测试相关术语 性能测试指标就是: 多(并发量)快(响应时间)好(稳定性[长时间运行])省(资源使用率).思考时间 1.负载 模拟业务操作对服务器造成压力的 ...

  6. linux学习------磁盘性能测试

    测试服务器  1核1G配置 下载后放在你想测试的目录下,执行preparefile.sh准备测试文件,完成后执行runTest.sh执行测试,等待测试结果完成. {sysbench_bin}> ...

  7. Unity3D之Mecanim动画系统学习笔记(五):Animator Controller

    简介 Animator Controller在Unity中是作为一种单独的配置文件存在的文件类型,其后缀为controller,Animator Controller包含了以下几种功能: 可以对多个动 ...

  8. Animator Controller 继承关系

    准备知识 对于Animator Controller中蜘蛛网一样的几十条连线,后续如果靠人工维护,那成本将是很大. AnimatorOverrideController组件的文档:https://do ...

  9. Animator

    [Animator] 1.State Machine Behaviours A State Machine Behaviour is a special class of script. In a s ...

随机推荐

  1. 为什么PCI-e比SATA快这么多?

    PCIe协议和SATA协议都是分层协议,分为物理层,数据链路层,传输层,命令层和应用层. 硬件工程师主要关注物理层.数据链路层和传输层.所有CMD/data由应用层和命令层打下来,每向下走一层,多一层 ...

  2. [Poetize II]七夕祭

    描述 Description TYVJ七夕祭和11区的夏祭的形式很像.矩 形的祭典会场由N排M列共计N×M个摊点组成.虽然摊点种类繁多,不过cl只对其中的一部分摊点感兴趣,比如章鱼烧.苹果糖.棉花糖. ...

  3. BZOJ1631: [Usaco2007 Feb]Cow Party

    1631: [Usaco2007 Feb]Cow Party Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 459  Solved: 338[Submit ...

  4. 【转】通知 Toast详细用法(显示view)

    原文网址:http://www.pocketdigi.com/20100904/87.html 今天学习Android通知 Toast的用法,Toast在手机屏幕上向用户显示一条信息,一段时间后信息会 ...

  5. 贪心 BZOJ 3671:[Noi2014]随机数生成器

    Description   Input 第 1行包含5个整数,依次为 x_0,a,b,c,d ,描述小H采用的随机数生成算法所需的随机种子.第2行包含三个整数 N,M,Q ,表示小H希望生成一个1到 ...

  6. 【最短路】NEERC15 F Froggy Ford(2015-2016 ACM-ICPC)(Codeforces GYM 100851)

    题目链接: http://codeforces.com/gym/100851 题目大意: 一只青蛙跳过宽为W的河,河中游N个石头,坐标xi,yi,现在往河中间添加一个石头,使得每次跳跃的最大的距离最小 ...

  7. HDOJ(HDU) 2178 猜数字(题意有点难理解、、、)

    Problem Description A有1数m,B来猜.B每猜一次,A就说"太大","太小"或"对了" . 问B猜n次可以猜到的最大数. ...

  8. LeetCode (13): 3Sum Closest

    https://leetcode.com/problems/3sum-closest/ [描述] Given an array S of n integers, find three integers ...

  9. Python里的map、reduce、filter、lambda、列表推导式

    Map函数: 原型:map(function, sequence),作用是将一个列表映射到另一个列表, 使用方法: def f(x): return x**2 l = range(1,10) map( ...

  10. 10th day

    貌似有几天没写博客了额.... 现在学习MySQL数据库,难度并不是很大,只是需要记忆的知识点比较多,好多语法之类的,比较容易混淆,而且老师讲课的速度还是蛮快的,虽然部分同学觉得听起来有点吃力,不过我 ...