在Swift游乐场无法加载纹理图集?

问题描述 投票:4回答:1

好吧,过去我只是通过键入其名称将SKTextureAtlas加载到我的班级,但是现在在Swift游乐场中我尝试添加几个扩展名(.atlas,.spriteatlas,没有扩展名......)和其他所有内容,但是我得到了错误:

Texture Atlas 'testAtlas' cannot be found.

这就是我得到这个:

override init(texture: SKTexture!, color: NSColor!, size: CGSize) {
        super.init(texture: texture, color: color, size: size)

        atlas = SKTextureAtlas(named: "testAtlas")
        print(atlas.textureNames) //to test if got it
    }

我认为这是一个问题,他们不是在操场上的目标,但我把它放入我的资源文件夹,它应该能够识别图集:

enter image description here

如何在Swift 3的游乐场中获得纹理图集?

swift swift3 swift-playground sktextureatlas
1个回答
0
投票

尝试将文件夹的名称更改为testAtlas.atlas

© www.soinside.com 2019 - 2024. All rights reserved.