本文由博主(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. struts2支持的结果处理类型

    有些东西常常在用,自己却忽略总结,这是一个特别的失误. struts2支持的结果处理类型 struts2的结果处理类型要在struts-default.xml文件中的<result-typs&g ...

  2. BZOJ 1053 [HAOI2007]反素数ant

    1053: [HAOI2007]反素数ant Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 1948  Solved: 1094[Submit][St ...

  3. MongoDB权限提升漏洞(CVE-2013-4650)

    漏洞版本: MongoDB 2.4.0-2.4.4 MongoDB 2.5.0 漏洞描述: CVE ID: CVE-2013-4650 MongoDB是一个高性能,开源,无模式的文档型数据库,是当前N ...

  4. 数据结构(树链剖分,线段树):SDOI 2016 游戏

    4515: [Sdoi2016]游戏 Time Limit: 40 Sec  Memory Limit: 256 MBSubmit: 351  Solved: 157[Submit][Status][ ...

  5. 在ASP.Net MVC 中,如何在Global.asax中配置一个指向Area内部的默认Route

    ASP.Net MVC 中配置Route的时候可以设置一个默认的Route. 比如我要在输入http://localhost的时候默认进入http://localhost/home/index.可以在 ...

  6. 解决wordpress的fonts.googleapis.com在国内无法访问的问题

    因为wordpress及主题的样式中几乎都使用了fonts.googleapis.com,而国内因为你知道的原因,是无法正常使用google服务的,因此导致在很多国内设备上打不开wordpress页面 ...

  7. 动态规划——H 最少回文串

    We say a sequence of characters is a palindrome if it is the same written forwards and backwards. Fo ...

  8. 最小生成树 10.1.5.253 1505 poj 1258 http://poj.org/problem?id=1258

    #include <iostream>// poj 1258 10.1.5.253 1505 using namespace std; #define N 105 // 顶点的最大个数 ( ...

  9. @synthesize和@dynamic分别有什么作用?

    @property有两个对应的词,一个是 @synthesize,一个是 @dynamic.如果 @synthesize和 @dynamic都没写,那么默认的就是@syntheszie var = _ ...

  10. pat 1060. Are They Equal (25)

    题目意思直接,要求将两个数转为科学计数法表示,然后比较是否相同  不过有精度要求 /* test 6 3 0.00 00.00 test 3 3 0.1 0.001 0.001=0.1*10^-2 p ...