SKNode 有 actions 属性吗?

发布于 2025-01-12 09:54:59 字数 754 浏览 2 评论 0原文

我想知道是否有一种简单的方法可以查看当前分配给 SpriteKit 中节点的所有操作的列表。类似于“actions”属性,它将包含所有节点操作的列表。 SKNode 的文档 没有显示类似的内容。

但是,我在 Xcode 调试器中放置了一个断点,发现我的 SKNode 上确实有一个 actions 属性:

debugger snapshot

您可以在调试器中看到这actions 数组包含在我的节点上运行的两个操作。但奇怪的是,如果我尝试在代码中访问该属性,则会收到错误:

let node = self as SKNode
print(node.actions)
// Value of type 'SKNode' has no member 'actions'

谁能告诉我 SKNode 上的这个 actions 属性来自哪里?为什么我们可以在调试器中看到它但无法在代码中访问它?

I wondered if there was an easy way to see a list of all actions currently assigned to a node in SpriteKit. Something like an "actions" property that will contain a list of all a node's actions. The documentation for SKNode does not show anything like this.

However, I put a breakpoint in the Xcode debugger and saw that indeed there was an actions property on my SKNode:

debugger screenshot

You can see in the debugger that this actions array contains two actions that are running on my node. But strangely, if I try to access that property in code I get an error:

let node = self as SKNode
print(node.actions)
// Value of type 'SKNode' has no member 'actions'

Can anyone tell me where this actions property on the SKNode is coming from? Why can we see it in the debugger but cannot access it in code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文