本文由博主(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. C# yield return 用法与解析

    原文:C# yield return 用法与解析 C# yield return 用法与解析 本文参考自:http://www.jb51.net/article/54810.htm 当初没有认真理解 ...

  2. 深入浅出 Java Concurrency (3): 原子操作 part 2

    转:http://www.blogjava.net/xylz/archive/2010/07/02/325079.html 在这一部分开始讨论数组原子操作和一些其他的原子操作. AtomicInteg ...

  3. spoj-694-Distinct Substrings(后缀数组)

    题意: 给定一个字符串,求不相同的子串的个数 分析: 每个子串一定是某个后缀的前缀,那么原问题等价于求所有后缀之间的不相同 的 前 缀 的 个 数 . 如 果 所 有 的 后 缀 按 照 suffix ...

  4. 数据结构(动态树):[国家集训队2012]tree(伍一鸣)

    [问题描述] 一棵n个点的树,每个点的初始权值为1.对于这棵树有q个操作,每个操作为以下四种操作之一: + u v c:将u到v的路径上的点的权值都加上自然数c: - u1 v1 u2 v2:将树中原 ...

  5. 数据结构(树链剖分,堆):HNOI 2016 network

    2215. [HNOI2016]网络 ★★★☆   输入文件:network_tenderRun.in   输出文件:network_tenderRun.out   简单对比时间限制:2 s   内存 ...

  6. [Locked] One Edit Distance

    One Edit Distance Given two strings S and T, determine if they are both one edit distance apart. 分析: ...

  7. 动态规划——数位dp

    通过先前在<动态规划——背包问题>中关于动态规划的初探,我们其实可以看到,动态规划其实不是像凸包.扩展欧几里得等是具体的算法,而是一种在解决问题中决策的思想.在不同的题目中,我们都需要根据 ...

  8. hdu-1272 并查集

    Problem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走.但是她设计迷宫的思路不一样,首先她认为所有的通道都应该 ...

  9. pygame学习资料

    pygame下载地址: https://bitbucket.org/pygame/pygame/downloads 12岁的少年教你用Python做小游戏 Beginning Game Program ...

  10. HashTable和HashMap的区别

    1.HashTable线程安全,同步,效率相对低下. HashMap线程不安全,非同步,效率相对高 2.父类:HashTable的父类是Dictionary HashMap是AbstractMap 3 ...