0

Hi I am using Libgdx to create a game. I am currently trying to add a button to my main menu screen. I have created a stage and have added the button actor to the stage. The problem is my app crashes on start up and my logcat says there is an error reading file data/ui/uiskin.json. This is really frustrating me please can you help me solve the error.

I have followed this exactly to no avail this is also where I got the uiskin files.Using scene2d.ui with libgdx: where does the skin come from?. Sample code below.

Skin skin = new Skin(Gdx.files.internal("data/ui/uiskin.json"));
    stage = new Stage();
    btnlogin = new TextButton("click me",skin);
    stage.addActor(btnlogin);

Render method

Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
     stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
        stage.draw();
Community
  • 1
  • 1
user2002077
  • 595
  • 1
  • 6
  • 17
  • It is now also saying field not found: scrollstyle – user2002077 Apr 11 '14 at 03:36
  • Try it again with the uiskin you can find here: https://github.com/libgdx/libgdx/tree/master/tests/gdx-tests-android/assets/data – noone Apr 11 '14 at 07:34
  • Hi thanks for your reply. I am using those files and still no luck :( . I really don't get why its doing this I can see the field right here in the .json file. com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: { default: { font: default-font, fontColor: white, background: default-select, scrollStyle: default, listStyle: { font: default-font, selection: default-select-selection } } }, – user2002077 Apr 11 '14 at 13:52

2 Answers2

0

Have you included the uiskin.atlas and uiskin.png in the same folder as your uiskin.json file? If not you will get an error.

The name of the atlas file must be the same as your json also, bar the file extension.

Colin
  • 267
  • 4
  • 11
0

Hi all thank you for your comments. I sat up all night fumbling over this and now it is working somehow. I updated Libgdx and that has seemed to fix it somehow even though I was on the latest version.

user2002077
  • 595
  • 1
  • 6
  • 17