2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Unity 6.5から、Android端末のAPI Levelを取得できるAndroidBuild.Versionが追加される

2
Last updated at Posted at 2026-05-03

Unity 6.5で、UnityEngine.Android名前空間にAndroidBuild.Versionが追加されます。

AndroidBuildはstaticクラスで、VersionはAndroidBuildの入れ子になったクラスです。

Versionクラスは、次の3個のstaticプロパティーを持ちます。

apiLevel

apiLevel staticプロパティーは、ゲーム・アプリケーションが実行されているAndroid端末の、API Level(OSバージョン)を取得できるプロパティーです。

内部的には、Androidのandroid.os.Build.VERSION.SDK_INTを利用しているようです。

minApiLevel

minApiLevel staticプロパティーは、ゲーム・アプリケーションが実行可能な最小API Level(OSバージョン)を司るプロパティーです。

関連:https://developer.android.com/ndk/guides/sdk-versions?hl=ja#minsdkversion

targetApiLevel

targetApiLevel staticプロパティーは、targetSdkVersionのラッパーのようです。アプリがターゲットとする API レベルを示す整数です。

関連

まとめ

AndroidBuild.Version.apiLevelにより、実行中のAndroid端末のAPILevel(OSバージョン)が簡潔に取得できるようになって良さそうです。

今までは、「AndroidJavaClassによるandroid.os.Buildのラッパー」を作ったり、SystemInfo.operatingSystemを使っていた、はず(多分)

個人的には、AndroidBuild.Versionの各種プロパティー名は「apiLevel」という名前にするよりも、Android公式に合わせた「sdkVersion」の方が好みです。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?