// Use this for initialization void Start() { #if !UNITY_EDITOR //此处代码用于发布版里,动态复制dll到指定目录,方便游戏的发布维护. string sourePath = UnityEngine.Application.dataPath + "/Plugins/CGDEVSDK.dll"; string destPath = UnityEngine.Application.dataPath + "/Mono/CGDEVSDK.dll"; try { bool isExitDll = File.Exists(destPath); //Debug.Log("isExitDll "+isExitDll); if (!isExitDll) { // Copy the file. File.Copy(sourePath, destPath); Debug.Log("{" + sourePath + "} copied to {" + destPath + "}"); //Restart app. UnityEngine.Application.Quit(); RunSystemCmd.RunCmd("start test.exe"); return; } } catch { Debug.Log("Double copy is not allowed, which was not expected."); } #endif //_Instance = this; CGCameraBufLen = CGCameraWith * CGCameraHeight; mImg = new Texture2D(CGCameraWith, CGCameraHeight, TextureFormat.ARGB32, false); mBufHandle = new byte[CGCameraBufLen]; FilePath = UnityEngine.Application.dataPath + "/../CGCamera"; if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath); } ImgPath = FilePath + "/CGCmaraTmp.png"; uint[] adwVersion = new uint[4]; CGAPI.DeviceGetSDKVersion(adwVersion); SearchDevices(); SelectedCGCameraDevice(); if (mDeviceHandle != IntPtr.Zero) { Debug.Log("Device start..."); CGAPI.DeviceStart(mDeviceHandle); SetCGCameraInfo(); } }