Configure an instant app for a game using the Google Play Instant Unity plugin

The steps for setting up apps to run on Google Play Instant, as explained
in Create your first instant
app, also apply
to games. This guide emphasizes some setup steps specific to games.

The Google Play Instant Unity plugin configures your project to create an
instant app version of your game.

This guide focuses on optimizing your game's download size and ensuring that an
install prompt appears when players interact with the instant app version of
your game. Before completing the steps on this page, install the Unity Plugin
from its Unity Asset Store
listing.

Google Play Instant fully supports the Unity game engine for building
instant apps. However, we're continuing to improve the product so that it's
easier to use. If you're interested in receiving these ease-of-use updates as
they become available, sign up for the
Unity Beta program.

Distribute your game's content into asset bundles

If only part of your game is available as an instant app, it's helpful for the
user to download your entire game one part at a time. To make this process
possible, create an instant app that contains only a simplified loading screen.
When the user starts this instant app, your app can then immediately start
downloading an asset bundle, or a package of resources, that contains the main
game scene from a content delivery network (CDN). Using this strategy, you delay
the downloading of most of your game's resources to the time when the player
first opens your game.

Optimize your instant app's size

Use Player Settings in the Unity plugin

The Google Play Instant Unity plugin includes the Player Settings dialog,
shown in Figure 1, which displays suggestions that help you optimize support
for Google Play Instant, develop against more compatible graphics API, and
reduce your APK's size.

Figure 1. The Player Settings dialog

Use Android Player Settings in Unity

If you're using Unity directly, you can reduce the size of your game's instant
app by using the Android Player Settings window instead. This window features
the following options that you can toggle on and off:

Use IL2CPP as scripting backend and enable engine stripping.

Use .NET 2.0 Subset as the API compatibility level.

Select only ARM under device filtering instead of including both ARM and x86
in the instant app.

Additionally, you can open the Package Manager and disable any packages you
won't be using.

Support installation workflows

Because the installation workflow is different for each game, the
Google Play Instant Unity plugin doesn't provide one by default.
Therefore, you need to add the following logic to enable your game's
installation flow:

Display the install prompt in your game's instant app.

Pass important information about the player's progress—such as their current
level, in-game rewards, and customizations—from the instant version of your game
to the installed one.

For examples on how to add this logic within your project, see the Unity Engine
Features
section of the plugin's GitHub project README.

Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.