-1

So when i start the app, the sprites all show up one time and everything is fine at first. Then when I check to see how it would do a second time one of the 5 SKspritenodes suddenly disappear. Then the next time I do it again all of the SKspritenodes are gone, then one more time and they reappear again.

How do I fix the sprites so that they consistently spawn when I start the app?

Here is my code: SpriteKit Code

Thanks in advance!

  • Please do not post links to code. You should update your question to include the relevant code that relates to your problem. – Andrew Feb 17 '22 at 19:09
  • Take a look at [ignoresSiblingOrder](https://developer.apple.com/documentation/spritekit/skview/1520215-ignoressiblingorder) property – Whirlwind Feb 23 '22 at 03:42

1 Answers1

1

short answer: change assets' z position from 0 to 1 in Attributes Inspector.

longer answer: if you load via .sks file you'll need to set your zPositions via the Attributes Inspector for the .sks file (not in code). you'll see that they are all 0. and if you have zPositions that are the same, they will render in an unpredictable z order, sometimes appearing before the background sometimes not.

Fault
  • 1,115
  • 1
  • 7
  • 11