I have created a dialog in Libgdx main menu screen.
I have tried
dialog.setPosition(300, 300); dialog.show(stage);
It doesn't do anything. Is it a camera trick? Am I missing something?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
Just in case some people encounter the same issue :
Libgdx javadoc says dialog is centered by default with show method.
dialog.setPosition(300, 300); stage.addActor(dialog);
dialog.showto let the dialog use these positions instead of default ones computed by show method.
You could use the
dialog.show(stage, sequence(Actions.alpha(0), Actions.fadeIn(0.4f, Interpolation.fade))); dialog.setPosition(position.x, position.y);
According to the source code, the general
show method just auto-sets the position to the center. By using this method, you could pass the auto-set center.