Unity WebGLA JavaScript API that renders 2D and 3D graphics in a web browser. The Unity WebGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering API to run Unity content in a web browser. More info
See in Glossary supports Input and InputSystem for gamepads and joysticks for browsers that support the HTML5 Gamepad API.
Some browsers only allow access to input devices after the end user interacts with the device while the application has focus. This is a security measure that prevents the end user using connected devices for browser fingerprinting purposes. For this reason, your application should instruct the user to press a button on their gamepad/joystick before you call Input.GetJoystickNames() to check for connected devices.
The WebGL game controllerA device to control objects and characters in a game.
See in Glossary mapping for the old input system aligns with the W3 spec, where the button mapping layout is shown as follows:
Buttons | Description |
---|---|
buttons[0] | Bottom button in right cluster = CROSS (X) |
buttons[1] | Right button in right cluster = CIRCLE |
buttons[2] | Left button in right cluster = SQUARE |
buttons[3] | Top button in right cluster = TRIANGLE |
Note: As WebGL follows the W3 spec, it might not be consistent with other platforms, and requires unique handling, especially, if you’re targeting multiple platforms simultaneously (for example, Windows and Web).
Unity WebGL doesn’t officially support mobile devices (see WebGL browser compatibility) but it does implement Input.touches and other related APIs in browsers and devices with touch support. By default, mobile devices display a soft keyboard on the touch screen for entering text into UI(User Interface) Allows a user to interact with your application. Unity currently supports three UI systems. More info
See in Glossary input fields. To disable this behavior, use the WebGLInput.mobileKeyboardSupport
property.
By default, Unity WebGL processes all keyboard input the web page receives, regardless of whether the WebGL canvas has focus or not. This is so the end user can start using a keyboard-based application without the need to click on the WebGL canvas.
Important: This can cause issues when there are other HTML elements on the page that should receive keyboard input, such as text fields. Unity consumes the input events before the rest of the page can receive them. To have HTML elements receive keyboard input, set WebGLInput.captureAllKeyboardInput to false
. When you do this, the application only receives input if the WebGL canvas has focus.
Unity WebGL doesn’t officially support mobile devices (see WebGL browser compatibility) but, for browsers and mobile devices with touch support, Unity WebGL includes support for the following sensors:
Important: Browsers only allow sensor input in secure contexts. This means you must serve the page over HTTPS. The single exception is http://localhost
, which you can use during development.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.