public static void Initialize() { if (Application.platform == RuntimePlatform.Android) { if (instance == null) { instance = new BluetoothForAndroid(); } GameObject emptyObject = new GameObject(); emptyObject.AddComponent <BluetoothBridgeForAndroid>(); javaClass = new AndroidJavaClass(BT_CLASS_NAME); javaClass.CallStatic("Initialize"); javaObject = javaClass.GetStatic <AndroidJavaObject>("btPlugin"); } }
void Start() { btForUnity = instance; DontDestroyOnLoad(gameObject); gameObject.name = "BluetoothForAndroid"; }