Are there any known limits to the number of SKReferenceNodes that can be added to a scene? This isn’t a hypothetical question. I have a game in the app store, which seems to run up against limits.
The game is a sidescrolling running game, and there are three types of enemies the players faces – a Squasher, a Shooter and a Floater. The actual enemy depends on who the player is – if you pick a Dem presidential candidate, the Squasher is a TeaBag; if you pick a GOP candidate, the Squasher is an AmnestyTaco. I’ve got a Plist that includes the type and X and Y coordinates that I use this to place SKReferenceNodes on the course.
It works fine for the first dozen or so Squashers. But then they simply don’t show up after that.
Plist screengrab:
https://www.evernote.com/l/AgAw3IuD2SFHZq8lXSBWV9xWrfB1miq1hEE
If I change the Squasher object type to something else (coins, platforms, etc.), the object appears at the proper coordinates. But if I try to make it a Squasher type, it simply doesn’t work:
Game screengrab - nothing appears when type is Squasher, but change to coins and it appears:
https://www.evernote.com/l/AgAqREn0AcVFH41Q2WRwIvuLlH071XLeQ-Y
I am copying and pasting in Plist, so there’s no difference between the earlier Squashers that show and the later ones that do not – except for the fact they do not appear.
I’m pretty stumped and am about to pull the plug on SKReferenceNodes altogether. Has anyone else encountered anything similar? Any suggestions on a way forward?
My code, btw, calling the reference nodes (which, again, works for the first 12 or so before simply not working):
// Add Objects
if let objects = theLevelData["Objects"] as! NSArray! {
for object in objects {
if (object["Type"] == "Squasher") {
if GlobalData.currentCandidateIndex < 2 {
var newObject:SKReferenceNode = SKReferenceNode(fileNamed: "Teabag")
let vv = object as! NSDictionary
let vX = vv["X"]! as! Int
let vY = vv["Y"]! as! Int
newObject.position = CGPoint(x: vX, y:vY)
objectLayer.addChild(newObject)
} else { ...
Thanks for any suggestions, tips, etc.
Cheers,
Kevin