首页 > 代码库 > callback
callback
What about the callback in Unigine?
Any function from system, world or editor scripts can be called in a C++ code. UnigineScript functions that are called from an external code are known as callbacks. Via callbacks scripts can communicate with each other, as well as with the external application.
The sequence of function call will be as follows:
- The interpreter exports the runWorldFunction() function to make it available from the script.
- The engine is initialized, and the init() function of the script is called. This function calls the exported runWorldFunction() function.
- The exported runWorldFunction() function calls the callback() function from the script.
- The engine enters the main loop, where it calls the counter() function from the script by using the Unigine::Engine::runWorldFunction() function
在脚本中函数的调用顺序是,先调用init()函数,然后调用exportecd function runWorldFunction(),因为runWorldFunction()中调用了脚本中的函数callback(),所以runWorldFunction()会先调用callback(),也就是说在脚本中会先执行callback().
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。