当前位置:网站首页>Behavior tree XML file hot load

Behavior tree XML file hot load

2022-06-26 09:05:00 LixiSchool

https://www.behaviac.com/tutorial12_hotreload/

behaviac Both the editor and runtime libraries in the component support hot loading , But only for XML/BSON Format behavior tree file .

In the editor , As long as the currently open behavior tree file is modified outside the editor for some reason ( for example , Force the synchronization of behavior tree files through the file version management system in the project , Or force modification of the behavior tree through a text editor XML Documents, etc. ), Then it can be refreshed automatically in the editor .

For the runtime side ( Or program side ), Just modify the behavior tree file in the editor and re export , So you don't have to quit the game while the game is running , The newly exported behavior tree can be loaded automatically . In this way, you can view or use the latest modification effect of the behavior tree in time .

Please refer to... For the update execution process of the behavior tree Update process .

To start the hot load function , You need to make sure that... Is called directly or indirectly on the runtime side Workspace::DebugUpdate() function , There are two ways :

  • If Agent The behavior tree of is by calling Workspace::Update() For centralized execution , There is no need to call Workspace::DebugUpdate() function
  • If Agent The behavior tree of is by calling Agent::btexec() To perform the , You need to call each time the game is updated Workspace::DebugUpdate() function
原网站

版权声明
本文为[LixiSchool]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260841060652.html