问题描述
运行SpriteKit游戏时,我在控制台中多次收到此错误.据我所知(尽管我不确定),游戏本身并没有受到影响,但是错误可能会带来其他一些影响,以及调试控制台的拥挤.
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.
我对该错误进行了一些研究,发现了一些可能的解决方案,但似乎都没有完全解决问题.这些解决方案包括将ignoresSiblingOrder
变为false
,并将纹理指定为SKTextureAtlas(named: "atlasName").textureNamed("textureName")
,但是这些方法不起作用.
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 use of textures and texture atlases in the assets catalogue, though I'm not completely sure. Here is how I am implementing some of these textures/images:
let Texture = SKTextureAtlas(named: "character").textureNamed("\character1")
character = SKSpriteNode(texture: Texture)
还:
let Atlas = SKTextureAtlas(named: "character")
var Frames = [SKTexture]()
let numImages = Atlas.textureNames.count
for var i=1; i<=numImages; i++ {
let textureName = "character(i)"
Frames.append(Atlas.textureNamed(textureName))
}
for var i=numImages; i>=1; i-- {
let TextureName = "character(i)"
Frames.append(Atlas.textureNamed(textureName))
}
let firstFrame = Frames[0]
character = SKSpriteNode(texture: firstFrame)
上面的代码仅用于创建一个数组来从中对角色进行动画处理,动画运行得非常好.
The above code is just used to create an array from which to animate the character, and the animation runs completely fine.
对于所有其他sprite节点,我使用SKSpriteNode(imageNamed: "imageName")
进行初始化,并使用资产目录中的图像名称,但不在纹理图集中.所有图像都有@ 1x,@ 2x和@ 3x版本.
For all my other sprite nodes, I initialize with SKSpriteNode(imageNamed: "imageName")
with the image name from the asset catalogue, but not within a texture atlas. All the images have @1x, @2x, and @3x versions.
我不确定错误消息是否还有其他可能的来源,或者上面的示例是否是错误的来源.
I'm not sure if there are any other possible sources for the error message, or if the examples above are the sources of the error.
这仅仅是Sprite Kit的错误,还是我的代码或资产的合法错误?
Is this just a bug with sprite kit, or a legitimate error with my code or assets?
谢谢!
推荐答案
我也有此错误.我认为这是Xcode 7.2错误,而不是您的错.在制作应用程序的过程中,我已经更新了Xcode,并且此消息开始不断在控制台中显示.根据此和链接,您在这里不必担心.
I have this error too. In my opinion, it's the Xcode 7.2 bug and not your fault. I've updated Xcode in the middle of making an app and this message starts to show up constantly in the console. According to this and that links, you have nothing to fear here.
这篇关于CUICatalog:无效的请求:在不指定惯用语的情况下请求子类型(它来自何处以及如何解决?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!