better-unity-webgl-template
better-unity-webgl-template copied to clipboard
How to set a maximum size limit?
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?
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 }}};
}