Created
November 18, 2013 05:59
-
-
Save takashicompany/7523219 to your computer and use it in GitHub Desktop.
UnityでAndroidプラグインの関数を使う時に使うスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Awake () { | |
// UnityPlayerクラスを取得 | |
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
// 現在のActivityを取得 | |
AndroidJavaObject activity = jc.GetStatic<AndroidJavaObject>("currentActivity"); | |
// Contextを取得 | |
AndroidJavaObject context = activity.Call<AndroidJavaObject>("getApplicationContext"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment