Skip to content

Instantly share code, notes, and snippets.

@niusounds
Last active December 14, 2018 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niusounds/aa82be8d3b0bd56b5a8957a41ef5cf77 to your computer and use it in GitHub Desktop.
Save niusounds/aa82be8d3b0bd56b5a8957a41ef5cf77 to your computer and use it in GitHub Desktop.
Get Android Activity (Context) reference from Unity C#
var unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
var activity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment