Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set a maximum size limit? #15

Open
saadjumani opened this issue Oct 18, 2020 · 1 comment
Open

How to set a maximum size limit? #15

saadjumani opened this issue Oct 18, 2020 · 1 comment

Comments

@saadjumani
Copy link

I want my game to be responsive if browser window is smaller than a specific size (960 px width). But stay the same size if window is larger. How do I go about doing that?

@greggman
Copy link
Owner

You could try editing Assets/WebGLTemplates/Better2020/TemplateData/style.css

Add these lines

#unity-container {
    width: 100%;
    height: 100%;
    display: flex;           /* added */
    justify-content: center; /* added */
    align-items: center;     /* added */
}
#unity-canvas {
    width: 100%;
    height: 100%;
    max-width: 960px;   /* added */
    max-height: 540px;  /* added */
    background: {{{ BACKGROUND_COLOR }}};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants