Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enumerate ALL nodes in a Sprite Kit scene?

I want to enumerate all the nodes in my scene. Not just the ones that are a child of the scene itself, but also the children of those, and the children of those etc... So I want to be able to go through the whole node hierarchy.

Is there a method to do that without knowing how deep the node tree goes?

like image 906
notadam Avatar asked Sep 09 '14 16:09

notadam


1 Answers

Yep, use enumerateChildNodesWithName:usingBlock: and pass //* as the node name. You should be able to call that on any node.

It's actually one of the examples in Apple's docs:

//* This search string matches every node in the node tree.

like image 153
Mike S Avatar answered Sep 23 '22 00:09

Mike S