当前位置: 首页 > news >正文

【Unity博客节选】Playable Graph Monitor 安装使用

注:软件版本Unity 6.0 + Timeline 1.8.7

作者:CSDN @ RingleaderWang
原文:《Unity第25期——Timeline结构及其源码浅析》
文章首发Github👍:《Timeline结构及其源码浅析》

Bilibili 视频版👍👍:《Timeline结构及其源码解析》https://www.bilibili.com/video/BV1bHjYzNE35

可以使用Playable Graph Monitor 查看 Timeline生成的graph。

安装步骤:

  1. open Edit/Project Settings/Package Manager

  2. add a new Scoped Registry (or edit the existing OpenUPM entry)

    • Name: package.openupm.com
    • URL: https://package.openupm.com
    • Scope(s): com.greenbamboogames.playablegraphmonitor
      在这里插入图片描述
  3. click Save or Apply

  4. open Window/Package Manager

  5. click +
    在这里插入图片描述

  6. select Add package by name... or Add package from git URL...

  7. paste com.greenbamboogames.playablegraphmonitor into name

  8. paste 2.6.3 into version
    在这里插入图片描述

  9. click Add

测试案例:

public AnimationClip clip;  
public AnimationClip clip2;  
private PlayableGraph graph;void DestoryGraph(PlayableGraph graph)  
{  if (graph.IsValid())  {        graph.Destroy();  }
}private void CreateMixerGraph(){DestoryGraph(graph);// 1. 创建 PlayableGraphgraph = PlayableGraph.Create("MixerPlayableGraph");// 2. 获取 Animator 并创建 AnimationPlayableOutputvar animator = GetComponent<Animator>();var animationOutput = AnimationPlayableOutput.Create(graph, "Animation", animator);// 3. 创建 AnimationClipPlayablevar clipPlayable = AnimationClipPlayable.Create(graph, clip);var clipPlayable2 = AnimationClipPlayable.Create(graph, clip2);// 4. 创建一个 Mixer,管理多个动画输入AnimationMixerPlayable mixer = AnimationMixerPlayable.Create(graph, 2);mixer.ConnectInput(0, clipPlayable, 0,1);mixer.ConnectInput(1, clipPlayable2, 0,1);// 5. 设置 mixer 作为输出animationOutput.SetSourcePlayable(mixer);// 6. 播放图谱graph.Play();}
public void OnDestroy()  
{  DestoryGraph(graph); 
}

逻辑很简单,就4步:

  • 创建graph
  • 创建playable、mixerPlayable 并 connect
  • 创建playableOutput 并 setSourceOutput
  • 运行graph

对应的graph如下:

如果你使用官方的PlayableGraph Visualizer 的话,你会发现和 Playable Graph Monitor所展示的不一样。

比如这个例子:

PlayableGraph Visualizer展示:

Playable Graph Monitor展示:

你可以发现区别很大,Visualizer从PlayableOutput往Playable构图,且两个PlayableOutput独立构图;而Monitor是从叶子Playable节点往PlayableOutput构图,两个PlayableOutput连在一个output端口上。

到底哪个对呢?

其实都对。Visualizer是从graph play角度构图的,Monitor是从graph create角度构图的。

执行遍历节点获取数据时,其发起端其实是PlayableOutput,所以Visualizer把各个PlayableOutput独立开来构图,但这种展示方式对认识graph的结构不如Monitor清晰,而且官方Visualizer不能缩放,插件还有些bug会导致系统闪退,所以直接用Monitor就行。

不过Monitor的展示还是有些问题,两个PlayableOutput连在同一个output port了,这应该是Unity Timeline自身的问题,你理解成第二个PlayableOutput连在第二个port就行,以此类推。(不影响运行)

http://www.xdnf.cn/news/716995.html

相关文章:

  • 安全帽检测算法AI智能分析网关V4守护工地/矿山/工厂等多场景作业安全
  • Accelerate实现多卡并行训练
  • Nexus仓库数据高可用备份与恢复方案(上)
  • MVCC(多版本并发控制)机制
  • Cangjie 中的值类型与引用类型
  • 设置变体控制两个apk, 一个是有密码,一个是没有密码!
  • 英语写作中“广泛、深入、详细地(的)”extensively、in-depth、at length (comprehensive )的用法
  • 46. Permutations和47. Permutations II
  • Spring Event(事件驱动机制)
  • 力扣面试150题--二叉树的右视图
  • leetcode hot100刷题日记——27.对称二叉树
  • ubuntu系统上运行jar程序输出时间时区不对
  • C#实现单实例应用程序:确保程序唯一运行实例
  • 算法第32天|509. 斐波那契数、70. 爬楼梯、746. 使用最小花费爬楼梯
  • 构筑电网“无形防线”: 防外破告警在线监测服务系统
  • 如何批量给局域网内网里的电脑发送信息
  • STM32 HAL库函数学习 GPIO篇
  • 【Redis】RDB和AOF混合使用
  • Java求职面试:从核心技术到AI与大数据的全面考核
  • 网络编程之网络编程预备知识
  • Python对接GPT-4o API接口:聊天与文件上传功能详解
  • 人工智能浪潮下,制造企业如何借力DeepSeek实现数字化转型?
  • cutlass学习教程
  • Security
  • Coze Space的分享体验:基于Y模型分析法的深入剖析
  • 交通违法拍照数据集,可识别接打电话,不系安全带的行为,支持YOLO,COCO JSON,VOC XML格式的标注数据集 最高正确识别率可达88.6%
  • window安装nginx
  • PostgreSQL查询一个表的数据
  • AI预测3D新模型百十个定位预测+胆码预测+去和尾2025年5月29日第92弹
  • N2语法 逆接