/// <summary> /// 在Android平台上,从(apk包中的) Assets目录复制文件至指定目录 /// 注意:只能在主线程中调用 /// </summary> /// <param name="sourceDir">源目录,是以 assets 为根目录的相对路径</param> /// <param name="destDir">目标目录</param> /// <param name="title">进度对话框标题</param> /// <returns></returns> public static void CopyAssetDirectory() { ColaLoom.QueueOnMainThread(() => { Debug.Log("CopyAssetDirectory, sourceDir = " + sourceDir + ", destDir = " + destDir); AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActitivy = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); Debug.Log("CopyAssetDirectory before execute"); bool ret = currentActitivy.Call <bool>("copyAssets", sourceDir, destDir); callback(ret); Debug.Log("CopyAssetDirectory finished"); }); }