swift - SpriteNode not rendered at first time when using atlases - works with xcassets -


i have strange behaviour when rendering skspritenodes using atlas via imagenamed.

sprite = skspritenode(imagenamed: triangle.triangletype1.spritename) sprite.size.height = tileheight sprite.size.width = tilewidth sprite.zrotation = degreestoradians(triangle.rotation) sprite.position = pointforcolumn(triangle.column, row:triangle.row, columnoffset: tilewidth, rowoffset: tileheight, tw: tilewidth,th: tileheight) trianglelayer.addchild(sprite) triangle.sprite1 = sprite addedtriangles++  print(sprite) 

some of sprites not rendered adding them layer (another skspritenode) first time - printing "sprite" shows they're size 0,0 , image shows "trviolet" instead of "trviolet@2x.png". other ones rendered supposed be.

removing nodes , executing same code second time work though.

when put image in xcassets works charm - first time.

is there way debug kind of behavior or have idea on might happening here?


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -