Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Update the GameActivity library

Change which version of the GameActivity library your application uses.
Read time 2 minutesLast updated 2 days ago

The GameActivity application entry point is implemented as a library separate from the Unity Editor, allowing you to update the library independently. This means when Google releases bug fixes that your project requires, you can acquire the fixes by updating the GameActivity library version.
By default, Unity uses a specific GameActivity library version for each Unity version. The instructions on this page apply only to updates within the same major version of the GameActivity library.
Important
Do not update across major versions of the GameActivity library. Updating across major versions requires Unity engine changes that you cannot perform manually and causes incompatibilities with the Unity runtime. Unity doesn't test every combination of Unity version and GameActivity library version. Update the library within the same major version only if you have a critical requirement that the recommended version doesn't meet, and test your application thoroughly.
For more information about the recommended GameActivity library version per Unity version, refer to Unity and GameActivity version compatibility.

Update the library version

To update the GameActivity library version, follow these steps:
  1. Refer to GameActivity requirements and compatibility to identify the GameActivity version compatible with your Unity version. Only proceed if you have a critical requirement that the recommended version doesn't meet.
  2. Open the
    build.gradle
    file.
  3. Locate the
    androidx.games:games-activity
    dependency.
  4. Change the version number to a compatible version.
  5. Save the file.
Rebuild and test your application to verify the new version integrates correctly.
For information on how to modify Gradle project files, refer to Modify Gradle project files.
Note
Make sure that the other AndroidX dependencies support the GameActivity version that you want to use. If they don't, you must update them too. For more information, refer to Declaring dependencies.

Additional resources