question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setDesignResolution causes UI to render incorrectly

See original GitHub issue

I have the following UI just to get things rolling:

private void SetupMenu()
{
    var ui = camera.addComponent(new UICanvas());
    ui.isFullScreen = true;

    var skin = Skin.createDefaultSkin();
    var table = ui.stage.addElement(new Table());
            
    table.setFillParent(true).center();

    var playTestButton = table.add(new TextButton("Play Test Level", skin)).setFillX().setMinHeight(30).getElement<TextButton>();
    playTestButton.onClicked += b =>
    {
        Game.scene = new PlayerTestScene();
    };

    table.row().setPadTop(15f);

    var exitButton = table.add(new TextButton("Exit", skin)).setFillX().setMinHeight(30).getElement<TextButton>();
    exitButton.onClicked += b =>
    {
        Game.exit();
    };
}

Any translation I make to the camera isn’t retained by the UI, so setting the position of the camera to (200, 200) would put the UI more towards the top left of the screen space. Even if I set the position of the UI’s entity, there is no change in its rendered position.

How do I make the UICanvas component’s rendered stage stay relative to my camera’s position while using a design resolution, i.e retain camera space rendering?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dresswithpocketscommented, Jan 30, 2018

Since the priority for the project I was working on was lowered, I’ll go ahead and close this without testing it out. If it ends up continuing to be an issue ill reopen or make another issue.

0reactions
Vanitcommented, Jan 30, 2018

All good, I just wanted to get a resolution in here for future reference 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Problem with ui::button and resolution policy ...
I am designing my scenes with Cocos Studio 2 at 640x1136, matching the design resolution. Then I load them on my scene's .cpp...
Read more >
UI scaling problem when using render-to-texture
But I'm finding that if the RenderTexture size is not exactly equal to the current screen resolution, the UI scaling system causes problems....
Read more >
How to solve problem with too many re-renders in context?
No, the problem you describing is that you have components that listen to data AND render UI, it should be separated, components to...
Read more >
Slow rendering | App quality
On later versions of Android, it's one of the most common reasons for the UI thread to stop running. Generally, the fix is...
Read more >
What problem does Virtual DOM solve for React? : r/Frontend
React renders to an virtual tree and then compares it with the previous one. It then applies the difference to the DOM.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found