sprite-kit

SpriteKit: find all descendants of SKNode of certain class?

瘦欲@ 提交于 2020-12-08 08:05:48
问题 This question shows how to find all children of a SKNode that belong to a certain class, but what if we want all descendants (e.g., grandchildren) that belong to a certain class? Is there a native way to do this in SpriteKit, or is the only option to create a recursive form of the solution from the aforementioned question? The SKNode documentation highlights a search function that lets you find descendants with a certain name, but is there a way to filter descendants by class and not be name?

SpriteKit: find all descendants of SKNode of certain class?

被刻印的时光 ゝ 提交于 2020-12-08 08:05:08
问题 This question shows how to find all children of a SKNode that belong to a certain class, but what if we want all descendants (e.g., grandchildren) that belong to a certain class? Is there a native way to do this in SpriteKit, or is the only option to create a recursive form of the solution from the aforementioned question? The SKNode documentation highlights a search function that lets you find descendants with a certain name, but is there a way to filter descendants by class and not be name?