com.badlogic.gdx.utils.GdxRuntimeException:读取包文件时出错:uiskin.atlas

时间:2015-04-02 15:26:31

标签: exception libgdx

我尝试用uiskin作为皮肤。 json,atlas和png文件位于同一个文件夹中。 它抛出异常。

com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: uiskin.atlas
        at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:187)
        at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231)
        at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226)
        at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216)
        at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:70)

更新:当前代码

Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
nameText = new TextField("", skin);

1 个答案:

答案 0 :(得分:1)

尝试:

Skin skin = new Skin(Gdx.files.internal(PATH_TO_JSON_FILE), new TextureAtlas(PATH_TO_PACK/ATLAS_FILE));