Access array in GameScene from SKSpriteNode class instance?

后端 未结 1 1142
[愿得一人]
[愿得一人] 2021-01-25 20:01

I\'ve created an array in my GameScene instance, and populated it inside didMove(to view: )...

From an instance of an SKSpriteNode, how do I access a value in that array

相关标签:
1条回答
  • 2021-01-25 20:49

    While the answer you've linked to will solve your problem, it introduces a coupling between the node and the scene which you might regret later. A more robust solution would allow the node to reference whatever scene it happens to be running in, which is a common design pattern in iOS called delegate pattern.

    0 讨论(0)
提交回复
热议问题