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

关于行为树可视化插件BehaviorDesigner

image

 

1、BehaviorTree的生命周期

// OnAwake is called once when the behavior tree is enabled. Think of it as a constructor
public virtual void OnAwake();
// OnStart is called immediately before execution. It is used to setup any variables that need to be reset from the previous run
public virtual void OnStart();
// OnUpdate runs the actual task
public virtual TaskStatus OnUpdate();
// OnEnd is called after execution on a success or failure.
public virtual void OnEnd();
// OnPause is called when the behavior is paused and resumed
public virtual void OnPause(bool paused);
// The priority select will need to know this tasks priority of running
public virtual float GetPriority();
// OnBehaviorComplete is called after the behavior tree finishes executing
public virtual void OnBehaviorComplete();
// OnReset is called by the inspector to reset the public properties
public virtual void OnReset();
// Allow OnDrawGizmos to be called from the tasks
public virtual void OnDrawGizmos();
// Keep a reference to the behavior that owns this task
public Behavior Owner;

重点说明,尤其在有重复repeat节点时,OnAwake、OnStart、OnUpdate、OnEnd、OnPause 都是节点自身的生命周期的通知,而OnBehaviorComplete是整个行为树结束时对每个task的通知。

在debug明显可以看到OnAwake只执行一次,OnStart、OnUpdate、OnEnd会执行很多次(因为Repeat节点反复执行task),OnUpdate更特殊,如果return状态Runing会不停执行知道非Running。而OnBehaviorComplete是只在整个行为停止以后通知,可以代替普通MonoBehavior的OnDestroy来执行兜底清理逻辑。

http://www.jsqmd.com/news/267111/

相关文章:

  • web入门121-130
  • C++各数据类型的内存和范围
  • 基于ssm+vue的学习空间服务平台[ssm]-计算机毕业设计源码+LW文档
  • EVCC EEBus智能充电:解锁家庭能源管理新境界
  • 基于python的电子商务购物商城系统设计与实现 协同过滤算法 多商家 会员折扣 积分兑换
  • 基于ssm+vue的网上代驾调度平台[ssm]-计算机毕业设计源码+LW文档
  • TrollInstallerX终极安装手册:iOS 14-16系统免越狱应用部署实战指南
  • 如何让每次OBS直播都像电影大片:StreamFX特效插件5分钟上手指南
  • Frigate开源监控系统:智能家庭安防的终极指南
  • 【Linalg】ElementwiseOpFusion 中其他优化模式技术分析
  • 【2026】 LLM 大模型系统学习指南 (5)
  • 重塑音乐体验:探索新一代插件管理器的无限可能
  • 【2026】 LLM 大模型系统学习指南 (6)
  • 2026年十大灵活用工平台排行榜,品为灵工(品为企服)拔得头筹 - 华Sir1
  • 原圈科技领衔2026AI市场分析榜单,助您告别信息焦虑与无效获客
  • 全网首推!154 页 RAG 实战手册,从基础入门到独立搭建RAG,全程干货,无废话!
  • 2026年梳理系统门窗招商加盟,山西科典优势在哪 - 工业品牌热点
  • ESP-01系列
  • 2026年全国灵活用工十大平台综合盘点:合规、稳定与效能如何兼得 - 华Sir1
  • 2026年十大灵活用工平台推荐:强合规、高实用,助力企业高效用工 - 华Sir1
  • 【飞腾平台实时Linux方案系列】第十二篇 - 飞腾平台实时Linux低功耗优化实践。
  • 重构微型泵版图:2026高性价比替代进口微型磁力泵厂家推荐 - 品牌2026
  • 【飞腾平台实时Linux方案系列】第十三篇 - 飞腾平台实时Linux中断优化与硬实时保障。
  • RimSort:彻底解决RimWorld模组管理难题的终极工具
  • composer报错:安装依赖需要输入token的情况
  • 【飞腾平台实时Linux方案系列】第十四篇 - 飞腾平台实时Linux远程运维与监控方案。
  • 2026年高速制袋机定制厂家排名,瑞安市天晟包装机械有限公司名列前茅! - 工业品牌热点
  • 小米音乐Docker镜像技术指南:架构创新与智能音乐管理
  • 2026年灵活用工平台实力TOP10榜单:资质、规模与服务体系三大维度解析 - 华Sir1
  • 【飞腾平台实时Linux方案系列】第十五篇 - 飞腾平台轨道交通实时控制方案设计。