This is small library to support Android GameMode and GameState APIs in Unity older than 2023.1. Unity 2023.1 or higher has built-in support for Android GameMode and GameState APIs. Interface of this library is same as Unity's one, you can easily migrate.
- Configuration of AndroidManifest.xml described in here is automatically done by this library when building app.
- You can configure finely via
Mobile Support > Android GameinsideProject Settingswindow.
- You can configure finely via
- Call
MobileSupport.AndroidGame.GameModeinsideOnApplicationPauseto get current game mode. - You can call
MobileSupport.AndroidGame.SetGameStateto tell the system what state your game is in.
private void OnApplicationPause(bool pauseStatus)
{
if (pauseStatus) return;
// switch game quality based on game mode when application resumed
Debug.Log($"AndroidGame.GameMode={AndroidGame.GameMode}");
}This library is compatible with the following environments.
- Unity 2020.3 or higher
- Android targetSdkVersion 33 or higher
To install the software, follow the steps below.
- Open the Package Manager from
Window > Package Manager "+" button > Add package from git URL- Enter the following
Or, open Packages/manifest.json and add the following to the dependencies block.
{
"dependencies": {
"jp.co.cyberagent.unity-mobile-support-android-game": "https://github.com/CyberAgentGameEntertainment/UnityMobileSupport.git?path=/Packages/MobileSupportAndroidGame"
}
}If you want to set the target version, write as follows.
To update the version, rewrite the version as described above. If you don't want to specify a version, you can also update the version by editing the hash of this library in the package-lock.json file.
{
"dependencies": {
"jp.co.cyberagent.unity-mobile-support-android-game": {
"version": "https://github.com/CyberAgentGameEntertainment/UnityMobileSupport.git?path=/Packages/MobileSupportAndroidGame",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "..."
}
}
}This software is released under the MIT license. You are free to use it within the scope of the license, but the following copyright and license notices are required.

