ios - Terminating app due to uncaught exception due to uncaught exception (Attemped to add a SKNode which already has a parent) error -
i'm trying make label shown when game launches, crashes starts. error "terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'attemped add sknode has parent: name:'(null)' text:'tap anywhere start!' fontname:'copperplate' position:{187.5, 333.5}'".this code:
let startgametextnode = sklabelnode(fontnamed: "copperplate") required init?(coder adecoder: nscoder) { super.init(coder: adecoder) } override init(size: cgsize) { super.init(size: size) startgametextnode.text = "tap anywhere start!" startgametextnode.horizontalalignmentmode = sklabelhorizontalalignmentmode.center startgametextnode.verticalalignmentmode = sklabelverticalalignmentmode.center startgametextnode.fontsize = 20 startgametextnode.fontcolor = skcolor.whitecolor() startgametextnode.position = cgpoint(x: scene!.size.width / 2, y: scene!.size.height / 2) addchild(startgametextnode)
i have background texture moves game launches, , i'm not sure if causing problem.
nevermind. got working. adding late on scene. moved before adds ground scene , app started working.
Comments
Post a Comment