Skip to content

Instantly share code, notes, and snippets.

@akbarsha03
Created April 20, 2018 12:19
Show Gist options
  • Save akbarsha03/2644f6301116ea710cedee3f985c8770 to your computer and use it in GitHub Desktop.
Save akbarsha03/2644f6301116ea710cedee3f985c8770 to your computer and use it in GitHub Desktop.
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);
}
}
}
@Deboracgs
Copy link

Hello, can you help me with unity3d integration with react native ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment