Build and deploy a Web application in mobile and desktop environments.
Before you get started, check the browser compatibility and technical limitations for Web. Make sure you’re aware of any limitations for developing a project for this platform.
For a guided tutorial of the Web platform, refer to Getting started with Unity Web.
To build and deploy a Web application, complete the following tasks:
To get started with Web, add the Web module to your project. Once you add the module, you can access the Web Player and Build settings.
Browser security policies restrict loading scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary from file:// URLs, so you can’t open a Web build directly from your file system by double-clicking index.html.
To test your project, do either of the following:
If you run your own web server, Unity doesn’t need to rebuild the project for every test. For a simple local server, try running one of these options:
python -m http.server
npx http-server
For more advanced server configurations, refer to Server configuration code samples and Deploy a web application for information about running your own server.
Before you publish, gather performance metrics and reduce the build size to make a project that runs smoothly with the best quality possible.
Use the Unity Profiler to get performance data and refer to Optimize your Web build and Optimize Web platform for mobile.
You need to host projects online to make them accessible to users. Use web hosting services such as Unity Play depending on your needs.