ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

unity之性能优化 PlayableGraph 动画应用(一)

2022-04-22 22:02:34  阅读:340  来源: 互联网

标签:动画 PlayableGraph private AnimationPlayableOutput unity 节点 Animator


PlayableGraph 概述: PlayableGraph是一组API 

PlayableGraph常用API:
PlayableGraph
AnimationPlayableOutput: IPlayableOutPut 输出节点
AnimationMixerPlayable: Iplayable 动画混合
AnimationClipPlayable: Iplayable 动画剪辑

可借用第三方可视化工具:
graph-visualizer 插件 进行查看,下载自行百度

 

 

废话不多说 ,直接上代码:

 1 using UnityEngine;
 2 using UnityEngine.Animations;
 3 using UnityEngine.Playables;
 4 
 5 public class TestPlayable : MonoBehaviour
 6 {
 7     private Animator m_Animator;
 8 
 9     [SerializeField]
10     private AnimationClip m_AnimationClip;
11     private PlayableGraph m_PlayableGraph;
12     private AnimationPlayableOutput m_AnimationPlayableOutput;
13 
14     void Awake()
15     {
16         m_Animator = GetComponent<Animator>();
17         //创建画布
18         m_PlayableGraph = PlayableGraph.Create("testGraph");
19         //为画布创建一个输出节点
20         m_AnimationPlayableOutput = AnimationPlayableOutput.Create(m_PlayableGraph, "OutPut", m_Animator);
21         Test1();
22     }
23 
24     void Test1()
25     {
26         //画布上创建一个动画剪辑,作为输入节点
27         AnimationClipPlayable animationClipPlayable = AnimationClipPlayable.Create(m_PlayableGraph, m_AnimationClip);
28         //连线(设置输出节点的输入源为动画剪辑)
29         m_AnimationPlayableOutput.SetSourcePlayable(animationClipPlayable, 0);
30         //播放
31         m_PlayableGraph.Play();
32     }
33 }

 

 

 

 

标签:动画,PlayableGraph,private,AnimationPlayableOutput,unity,节点,Animator
来源: https://www.cnblogs.com/zhaolaosan/p/15841436.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有