gpt4 book ai didi

cocos2d-x - CocosBuilder中的 'Doc root var'和 'Owner var'有什么区别

转载 作者:行者123 更新时间:2023-12-02 22:46:01 24 4
gpt4 key购买 nike

在CocosBuilder中,有一个代码连接部分。第二行有三个选项:不分配文档根变量所有者变量

有时候,我在选择Owner var时会出错,但是当我将其更改为Doc root var后,它就正常了。

我用谷歌搜索了很多,但找不到满意的答案。

谁能解释清楚其中的区别吗?

最佳答案

不分配仅仅意​​味着您没有使用代码连接

Doc root var 表示您正在连接自定义 cocos2d 类。这会将文档(CCB 阶段/文件)中的对象粘合/连接到您的代码。此选项很方便,但您必须确保提供根节点的 Controller 对象。

Sometimes you need to be able to access member variables from and get callbacks to another object than the root node of a ccb-file. To do this you will need to pass an owner to the CCBReader.

Connecting with cocos2d-x 中所述.

所有者变量为您提供more flexibility允许您连接到根节点以外的变量。您可以将其粘贴到您选择的任何变量。

您收到的错误很可能是由于提供的名称不可用(变量不存在)引起的。请注意,将该属性设置为Doc root varOwner var 并将该字段留空将导致此错误。

关于cocos2d-x - CocosBuilder中的 'Doc root var'和 'Owner var'有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15107426/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com