sktexture

CUICatalog: Invalid Request: requesting subtype without specifying idiom (Where is it coming from and how to fix it?)

99封情书 提交于 2019-12-04 22:26:22
When I run my SpriteKit game, I receive this error multiple times in the console. As far as I can tell (though I'm not completely sure), the game itself is unaffected, but the error might have some other implications, along with crowding the debug console. I did some research into the error, and found a few possible solutions, none of which seem to have completely worked. These solutions include turning ignoresSiblingOrder to false , and specifying textures as SKTextureAtlas(named: "atlasName").textureNamed("textureName") , but these did not work. I think the error is coming somewhere from the

Swift : How to handle a lot of textures in memory

心已入冬 提交于 2019-12-04 15:43:35
I have a lot of characters in my game and because of that I have so many textures. When a texture atlas is loaded (containing about 5 different image textures) it increases the memory use and keeps it there at that amount. So the more textures just keeps driving that number up and up until sometimes the application crashes. I don't need all the characters at once, how can i maybe load some character textures when I need them and deallocate the others when i don't, but ill need to be able to bring it back. Rule 1 First of all you don't need to manually load in memory your texture atlas. When

should I cache textures in properties in sprite kit?

為{幸葍}努か 提交于 2019-12-04 06:43:46
问题 I am using atlases for the image assets in my game. I am preloading all my atlases at the beginning of my Game Scene with SKTextureAtlas preloadTextureAtlases which made a big difference when I started using it. Here is my question: Should I create a property for each texture that is going to be applied again and again to spawned monster or pickup sprites? Or is it completely unnecessary overhead because I am preloading my atlases in my Game Scene? The below are 2 very simple examples in a

SpriteKit - How to fix distortion in Node's animation?

一曲冷凌霜 提交于 2019-12-02 09:43:37
I have created an animation of various PNGs, but there are various frames that stretch to the border so the node is 'filled'. The animation should look like the GIF that I have created using the same pictures. Does anybody know how to make the animation look like the GIF? GIF: Gif: Animation should look like this Actual: Extra slow Actual result of the code Border: Here you can see the border of the physics body that has the same size of the "node's border" I have tried to fix the problem by switching the scene.scalemode. Further, I have tried to make the size of the Node dependent on the size

Animate an SKSpriteNode with textures that have a size different from the original

扶醉桌前 提交于 2019-12-01 12:44:51
I want to animate an SKSpriteNode using textures from an SKTextureAtlas, using SKAction.animateWithTextures(textures,timePerFrame,resize,restore) . However, the textures in the atlas have a size that is slightly larger than the original texture (it's basically a character moving). When the action is run, the textures are either compressed to fit the original size of the sprite, or recentered when I set resize to false , which changes the position of the character. What I want, though, is for the textures to be anchored at the lower-left corner (or lower-right, depending on the direction) so

SKTexture preloading

怎甘沉沦 提交于 2019-12-01 00:46:15
When you preload textures using the spritekit preloadTextures function, it loads all the textures in the provided array into the memory at once. If you don't have the ability to split up your levels in your game with 'loading screens' but do have separate levels with different image files than each other, how can you keep from storing all the images in memory at once without sacrificing frame rate when spritekit loads the images when it needs to? Andrew97p You could create a singleton class with methods for loading and unloading resources specific to the level you are currently playing. For

Xcode 9 Crashing while setting a Texture in SKScene in Spritekit

大城市里の小女人 提交于 2019-11-30 06:53:28
I am building a game in Spritekit with Xcode currently. After updating to Xcode 9 I've found that every time I set a texture through the .sks file, Xcode crashes instantly. I've restarted my computer, updated the app, reloaded the textures and nothing changed. I have the 2017 Macbook Prof 13" w/ touch bar. Here are the diagnostics: Process: Xcode [577] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 9.0.1 (13249) Build Info: IDEFrameworks-13249000000000000~2 App Item ID: 497799835 App External ID: 823984564 Code Type: X86-64 (Native) Parent Process: ?

Create \\(Use) SKView as \\(in a) factory \\(static class)

倖福魔咒の 提交于 2019-11-29 12:41:39
I want to make an SKView I can use as a factory to make SKShapeNodes and "render" them to textures. But I can't find how I would initialise such a thing, and am having no luck, at all. How do I make a standalone SKView for this purpose? Or is there a better way to do this that avoids using the gamescene? Here's my FUTILE Effort at making a factory, this complains that texture(from: ) is ambiguous . I have no idea what that means. import SpriteKit class Make: SKView{ static func circle() -> SKSpriteNode { let myShapeNode = SKShapeNode(circleOfRadius: 100) myShapeNode.fillColor = SKColor

How does SKTexture caching and reuse work in SpriteKit?

心不动则不痛 提交于 2019-11-28 20:53:21
It is often mentioned on StackOverflow that SpriteKit does its own internal caching and reuse. Does Sprite Kit load a texture atlas multiple times if I use SKTextureAtlas later? should I cache textures in properties in sprite kit? SpriteKit memory management preload cached and fps issue If I don't make any effort to reuse textures or atlases, what caching and reuse behavior can I expect from SpriteKit? Karl Voskuil Texture Caching in SpriteKit “Long story short: rely on Sprite Kit to do the right thing for you.” -@LearnCocos2D Here’s the long story, as of iOS 9. The texture’s bulky image data

Folder of images: create and fill SKShapeNodes, 1 of each

回眸只為那壹抹淺笑 提交于 2019-11-28 06:05:29
问题 Is it possible to create a folder and have SpriteKit go through that folder, find each image (regardless of name), and create a SKShapeNode for each in that folder (regardless of how many there are)? Assume all images are the same size, and all .png files ready to be used as unique images as textures for filling SKShapeNodes, and that all SKShapeNodes will be the same size. I want to know, once done, how many shapes have been created, and have them uniquely named based on the name of the