This section contains information on developing for the Chrome OS platform. In general, all Android documentation in the Unity User manual also applies to Chrome OS, but there are some differences and new things to consider that are in this section.
Make sure that you follow Google’s Developer Documentation on how to prepare your development environment. Make sure that you use Android Debug Bridge (adb) over WiFi or ethernet to connect to your device. This makes it easier for Unity to discover and connect to your device.
In the Build Settings, there are two specific Chrome OS targets: x86 and x86–64. To natively support the full spectrum of Chrome OS devices, select both of these as the build target, plus the existing ARM options.
If you instead want to limit the devices on which your Android application can run, use the Target Devices Player Setting. Set this to Phones, Tablets, and TV Devices Only to limit your application to run only on phones, tablets, and TV devices. Select Chrome OS Devices Only if you only want to run on Chrome OS and want to avoid all other Android devices.
You must connect with adb to run a built APK on your Chrome OS device.
In addition to the existing Android player settings, there are some Player Settings that are specific to Chrome OS:
Player Setting | 설명 | |
---|---|---|
Target Architectures | Select which target architecture you want to support. To support all Chrome OS devices, you must select both of these as the build target. | |
x86 (Chrome OS) | This is only supported for Chrome OS, 32-bit x86. | |
x86–64 (Chrome OS) | This is only supported for Chrome OS, 64-bit x86–64. | |
TargetDevices | Use this setting to constrain the devices on which your application is allowed to run. | |
All Devices | No constraints placed. | |
Phones, Tablets, and TV Devices Only | Constrains your application to only run on Android phones, tablets, and TV devices. | |
Chrome OS Devices Only | Excludes all Android phones and tablets and allows your application to run only on Chrome OS devices. | |
Chrome OS Input Emulation | This setting converts all mouse and touchpad events into touchscreen events. This setting is enabled by default. This setting is useful if you developed your application for Android and you want it to work on Chrome OS with no extra development. If you want your application to fully receive all mouse and touchpad events, and fully support those input devices on ChromeOS, you should disable this setting. By default, on Chrome OS, an application misses mouse positional updates (when a button isn’t pressed) and both mouse or touchpad scrolling events and button presses. |
Automatic discovery of Unity applications for managed debuggers and the Unity Profiler isn’t supported because of networking restrictions on Chrome OS. Both work but you must connect to them manually via the device’s IP address. For more information, see Profiling your application documentation.
The Android window-related player settings are important on Chrome OS because it has a desktop windowing user interface. You can use these settings to allow your application to start full-screen or in a window, determine the starting and minimum sizes of the window, and whether it is resizable or not. Windowing behavior is also affected by which orientations are allowed via auto-rotation.
For the most optimum performance, you should either allow portrait orientation, or landscape orientation: but not both. You should also allow windowed applications to be resized if they aren’t in full-screen. This is because there are several known issues with rotating and windowing, which currently limit the behavior of your application in these modes.
Chrome OS devices come in a variety of form factors including laptop and tablet forms. Some devices support both modes. Because a lot of Chrome OS devices are laptops or have a laptop mode, this places a greater importance on mouse, touchpad, and keyboard input than is typical in a standard Android app that’s touchscreen-based.
By default, Chrome OS emulates touchscreen input, even if the end user is using a mouse or touchpad. This means that an Android app that was developed with phones and tablets in mind is usable by default on a Chrome OS device. If you want to get the most out of these new input devices, you should disable the Player Setting Chrome OS Input Emulation. This option then allows mouse and touchpad input to come through unchanged to your app. This means you need to write Unity input code to handle mouse input and touchpad input; but if you do this, you need to be able to read the cursor position, handle button presses and touchpad clicks, and read scrolling events.
Android and Chrome OS supports custom cursors. This works just like it does on other platforms.
Unity has a few UI systems available. In general on Android, whenever there is an input field or text field selected, the virtual on-screen keyboard always comes up so that the user can enter text. On Chrome OS, if there is a hardware keyboard available, then the on-screen keyboard is not shown or used. If there is no hardware keyboard available, then the on-screen keyboard is used like normal on Android. Please note: if your app specifically asks to open a TouchScreenKeyboard, this works the same on Chrome OS.
Many UI widgets are highlighted if the user’s mouse cursor hovers over them. On Chrome OS, this only works if mouse positions are reported reliably, which is dependent on the Chrome OS Input Emulation Player Setting being disabled.
Unity supports all brands of Chrome OS devices that are in a laptop, tablet, netbook or desktop form. Chromecast devices aren’t supported. The minimum supported major Chrome OS version is R89 and any following release on the “stable” release channel. As on other platforms, you can use beta and development OS builds at your own discretion.