[英]Loading error LibGDX/Scene2d
我得到這個:
線程“ LWJGL應用程序”中的異常com.badlogic.gdx.utils.SerializationException:讀取文件ui / skin.json時出錯
我正在嘗試為我的scene2D ui加載皮膚,但完全失敗了。
無論如何,當我上課時,該錯誤會在load方法中引發,所以這是一個加載問題吧?
另外,為什么不加載?
@Override
public void show() {
// Creates our atlas from our png file containing all the sprites
atlas = new TextureAtlas("ui/atlas.atlas");
// Create a stage, everything goes on the stage
stage = new Stage();
// A skin for the stage
skin = new Skin(Gdx.files.internal("ui/skin.json"), atlas);
該文件在那里,確切命名,項目已清理,刷新並重新導入。 甚至嘗試將其移動到資產文件夾中。 只是不斷拋出一個錯誤。
這是我的json文件:
{
"com.badlogic.gdx.graphics.Color": {
"white": { "r": 1, "g": 1, "b": 1, "a": 1 },
"black": { "r": 0, "g": 0, "b": 0, "a": 1 },
"red": { "r": 1, "g": 0, "b": 0, "a": 1 },
"green": { "r": 0, "g": 1, "b": 0, "a": 1 },
"blue": { "r": 0, "g": 0, "b": 1, "a": 1 }
},
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"fontSFNightly": { "file": "fonts/fontSFNightly.fnt" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
"heading": { "font": "fontSFNightly", "fontColor": "white" }
},
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
"mainMenu": { "up": "button.up", "down": "button.down", "pressedOffsetX": 1, "pressedOffsetY": -1 }
}
}
相當直截了當,跟隨dermetfans的視頻,這樣我就可以了解有關程序結構的更多信息以及不了解的內容,這開始引起我的注意
我設法解決了。
事實證明,從JSON文件讀取字體對象存在某種問題,我使用的是來自1001fonts.com的第三方字體,我不確定為什么它無法加載。
我將其更改為標准Windows ariel字體,現在嘗試弄清楚為什么自定義字體無法正常工作。
因此,此問題在技術上已解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.