Giter Site home page Giter Site logo

alvine-greatest / unity-webgl-responsive Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sno/unity-webgl-responsive

0.0 0.0 0.0 19.25 MB

Responsive layout for Unity WebGL applications

License: MIT License

JavaScript 66.72% CSS 17.39% HTML 15.90%

unity-webgl-responsive's Introduction

unity-webgl-responsive

Responsive layout template for Unity WebGL applications, intended for websites that have more going on than the application itself.

Demo GIF

Demo

How to use

Create a folder called WebGLTemplates in the Assets folder of your Unity project.

For Unity 2018 and 2019, copy the responsive-template folder and all of its contents into WebGLTemplates.

For Unity 2020.1 and newer, copy the responsive-template-2020 folder instead, as changes to the WebGL loader and templates were introduced with 2020.1.

Folder location

Select the template in the Player settings (Edit > Project Settings then select the Player category) and set the default canvas resolution.

Template settings

Optionally, change the properties of .webgl-wrapper in style.css to set the application's maximum width:

.webgl-wrapper {
  width: 100%;
  max-width: 1280px; /* remove this line for full width */
}

For Gzip-compressed builds (see Publishing Settings), you should turn on Decompression Fallback or configure your web server to add Content-Encoding: gzip response header.

Notes

  • Press F to toggle fullscreen. Customize this behavior in the script at the bottom of index.html.
  • The application canvas preserves the aspect ratio set in the Player settings in Project Settings.

Resulting HTML includes credits and a link back to this page, which is appreciated, but feel free to remove all of that and modify the template as needed. Disney head in the example project courtesy of David OReilly.

unity-webgl-responsive's People

Contributors

sno avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.