SpriteKit zPosition behaviour inconsistency

Originator:crayment16
Number:rdar://18143805 Date Originated:26-Aug-2014 09:33 PM
Status:Open Resolved:
Product:OS X SDK Product Version:iOS 7.1
Classification:Other Bug Reproducible:Always
 
Summary:
When child nodes have the same zPosition the docs for zPosition state:

“If multiple nodes share the same z position, those nodes are sorted so that parent nodes are drawn before their children, and siblings are rendered in the order that they appear in their parent’s children array.”

However if you look at the docs on SKView for ignoresSiblingOrder it states:

“The default value is NO, which means that when multiple nodes share the same z position, those nodes are sorted and rendered in a deterministic order. Parents are rendered before their children, and siblings are rendered from eldest to youngest.”

The order they appear in their parents array vs eldest to youngest are not the same thing.

Steps to Reproduce:
- Use addChild: to add a node to the scene
- Use insertChild:atIndex: to insert a new child in front of the first in the parent’s children array

Expected Results:
The child inserted 2nd but earlier in the array to appear behind the first child.

Actual Results:
The 2nd child appears in front

Regression:
N/A

Notes:
By using the documentation for zPosition (the order they appear in their parents array) it gives more control to the developer. Otherwise to have a node appear behind an already inserted node you must switch to specifying zPosition or you have to remove the first node and add it back. I want to have control of zPosition without jumping through these hoops.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!