Setting up Unity's Device Simulator

Setting up Unity’s Device Simulator

Unity’s Device Simulator is a very nice extension in Unity that allows users to quickly and easily test out their games on a mobile platform. It extends the Game window by adding a dropdown that allows the user to switch between the Game view and a newly-added Simulator view.

Unity's Device Simulator in the Game window
Unity’s Device Simulator on the Game window.

Note: The Device Simulator will be available by default in Unity 2021.1 and above. If you are using those versions of Unity, you will not need to install Device Simulator. Just check your Game window (see the image above) to see if there is an option to switch to the mobile device view.

  1. Installing the Device Simulator
  2. Using the Device Simulator
    1. Scale the simulated device
    2. Fit the device to your Simulator window
    3. Rotate the simulated device
    4. Toggle safe area for UI
    5. The Control Panel
  3. Conclusion

1. Installing the Device Simulator

To install the Device Simulator, head to Window > Package Manager to open Unity’s Package Manager. Then:

  1. Make sure that the Packages dropdown has Unity Registry selected.
  2. Make sure that preview packages are enabled in the Package Manager. If it is not enabled, you will have to access Advanced Project Settings, and turn on Enable Preview Packages from there.
  3. With Preview Packages turned on, you should be able to find the Device Simulator package.

Refer to the animated image below, demonstrating how to perform the 3 steps listed above:

Find the Device Simulator in the Package Manager
Finding the Device Simulator package in the Package Manager.

Note that for earlier versions of Unity, the toggle for preview packages is under Advanced > Show Preview Packages.

Show Preview Packages in older Unity versions.
Enabling preview packages in older Unity versions.

2. Using the Device Simulator

The Device Simulator — as its name implies — is window that simulates how your Unity project will look on different mobile devices and tablets.

Unity Device Simulator's different devices
Testing the Unity project on different mobile devices.

It’s interface is also very simple. Besides switching between different devices, you can also do the following:

a. Scale the simulated device

Toggling the Scale slider allows you to adjust the zoom of the simulated device.

Unity Device Simulator Scale
Zooming the Device Simulator in and out.

Article continues after the advertisement:

b. Fit the device to your Simulator window

If you can’t get the simulated device to appear with the right scale, you can use the Fit to Screen button to automatically resize it to fit your window.

Unity Device Simulator Fit to Screen
Automatically fits the simulated device to your viewport.

Note that the Fit to Screen button is a toggle. If you turn it on and rotate the device, or change a device, the new simulated device view will always fit the screen until you untoggle the button.

c. Rotate the simulated device

You can also rotate the device to view it at different orientations.

Unity Device Simulator Rotate
Rotating the simulated device.

d. Toggle Safe Area for UI

The Safe Area button outlines the screen area of the device where it is safe to place UI. For most phones, this will be the borders of the screen, but some phones with buttons or cameras on the screen area will have slightly different safe areas.

Unity Device Simulator Safe Area
The Safe Area for some phones are not at the borders of their screens.

e. The Control Panel

Finally, the Control Panel tab on the top-right corner of the screen toggles a panel that allows us to simulate a few settings on the device:

Unity Device Simulator Control Panel
The Control Panel allows us to simulate certain device situations, such as internet connectivity and low memory situations.
  1. System Language: Change the language that is set on the simulated device. This can be useful if your app supports multiple languages.
  2. Internet Reachability: You can simulate 3 kinds of internet connectivity conditions on the device. These simulations are often used to test notifications on your app for specific situations (e.g. notifying a user when they are playing on mobile data, so that they don’t blow their quota).
    1. Not Reachable: Which is when the device has no internet connectivity.
    2. Reachable Via Carrier Data Network: Which is when the device is connected by mobile data.
    3. Reachable Via Local Area Network: Which is when the device is connected to WiFi.
  3. On Low Memory: This button simulates the app of having low memory. Again, this simulation is often used to test notifications on your app.

3. Conclusion

The Device Simulator is a really convenient extension for the Unity Editor that makes it a lot easier to develop mobile applications. If you find that it doesn’t fit your needs, you can also look at using Unity Remote to test your game in the editor instead, using one of the 2 guides below.

Article continues after the advertisement:

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can use Markdown to format your comments.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.

This site uses Akismet to reduce spam. Learn how your comment data is processed.