Created
April 20, 2018 12:19
-
-
Save akbarsha03/2644f6301116ea710cedee3f985c8770 to your computer and use it in GitHub Desktop.
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class AndroidLauncherScript : MonoBehaviour { | |
void OnGUI() { | |
if (GUI.Button(new Rect(10, 70, 200, 30), "Launch react native activity")) { | |
Debug.Log("Button clicked"); | |
var unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
var currentActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity"); | |
var reactNativeActivity = new AndroidJavaClass("com.akbarsha03.reactmodule.ReactNativeActivity"); | |
reactNativeActivity.CallStatic("launchReactActivity", currentActivity); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, can you help me with unity3d integration with react native ?