public static void InitEnv() { if (ExternalMsgHandle.Instance == null) { GameObject obj = new GameObject(); mSdkCallback = obj.AddComponent <ExternalMsgHandle>(); } string channelId = ExternalMsgHandle.CallExternalFun <string>("getChannelId"); mSdkImpl = SDKFactory.CreateSDKComponent(channelId); //初始化TalkingData SDK //TalkingDataManager.Init(); }
void Awake() { if (Instance != null) { Destroy(Instance); } Instance = this; DontDestroyOnLoad(this); gameObject.name = gameObjectName; #if UNITY_ANDROID && !UNITY_EDITOR try { mUPlayerJc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); mActivityJo = mUPlayerJc.GetStatic <AndroidJavaObject>("currentActivity"); } catch (System.Exception e) { LuaInterface.Debugger.LogError(e); } #endif }