{"id":1246,"date":"2015-05-25T14:35:03","date_gmt":"2015-05-25T14:35:03","guid":{"rendered":"http:\/\/blog.zhukunqian.com\/?p=1246"},"modified":"2015-05-26T06:16:28","modified_gmt":"2015-05-26T06:16:28","slug":"unity%e4%b8%ad%e7%9a%84streaming%e6%96%87%e4%bb%b6%e8%b7%af%e5%be%84","status":"publish","type":"post","link":"https:\/\/blog.zhukunqian.com\/?p=1246","title":{"rendered":"unity\u4e2d\u7684streaming\u6587\u4ef6\u8def\u5f84"},"content":{"rendered":"<pre class=\"brush: bash; gutter: true\">\tIEnumerator test1(){\r\n\t\tString filePath1=Application.streamingAssetsPath+&quot;\/Boss.bank&quot;;\r\n\t\tString filePath2=&quot;file:\/\/\/&quot;+Application.streamingAssetsPath+&quot;\/Boss.bank&quot;;\r\n\t\tString filePath3=System.IO.Path.Combine(Application.streamingAssetsPath,&quot;\/Boss.bank&quot;);\r\n\t\tString filePath4=System.IO.Path.Combine(Application.streamingAssetsPath,&quot;Boss.bank&quot;);\r\n\r\n\r\n\t\ttextbox1.label.text=filePath1+&quot;\\n\\n&quot;+filePath2+&quot;\\n\\n&quot;+filePath3+&quot;\\n\\n&quot;+filePath4+&quot;\\n\\n&quot;;\r\n\r\n\t\ttextbox1.label.text+=File.Exists(filePath1)+&quot;\\n&quot;;\r\n\t\ttextbox1.label.text+=File.Exists(filePath2)+&quot;\\n&quot;;\r\n\t\ttextbox1.label.text+=File.Exists(filePath3)+&quot;\\n&quot;;\r\n\t\ttextbox1.label.text+=File.Exists(filePath4)+&quot;\\n&quot;;\r\n\r\n\t\tWWW www1=new WWW(filePath1);\r\n\t\tyield return www1;\r\n\r\n\t\tWWW www2=new WWW(filePath2);\r\n\t\tyield return www2; \r\n\r\n\t\tWWW www3=new WWW(filePath3);\r\n\t\tyield return www3;\r\n\r\n\t\tWWW www4=new WWW(filePath4);\r\n\t\tyield return www4;\r\n\r\n\t\ttextbox1.label.text+=www1.bytesDownloaded+&quot; &quot;+www1.error+&quot;\\n&quot;;\r\n\t\ttextbox1.label.text+=www2.bytesDownloaded+&quot; &quot;+www2.error+&quot;\\n&quot;;\t\t\r\n\t\ttextbox1.label.text+=www3.bytesDownloaded+&quot; &quot;+www3.error+&quot;\\n&quot;;\t\t\r\n\t\ttextbox1.label.text+=www4.bytesDownloaded+&quot; &quot;+www4.error+&quot;\\n&quot;;\r\n\t}<\/pre>\n<p>&nbsp;<\/p>\n<p>PC \u8fd0\u884c\u5982\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1247 \" src=\"http:\/\/blog.zhukunqian.com\/wp-content\/uploads\/2015\/05\/img_55632e6998ee4.png\" alt=\"\" \/><\/p>\n<p>android\u624b\u673a\u8fd0\u884c\u5982\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1248 \" src=\"http:\/\/blog.zhukunqian.com\/wp-content\/uploads\/2015\/05\/img_55633101b19fd.png\" alt=\"\" \/><\/p>\n<p>\u5982\u679c\u5728unity\u4e2d\u53d6\u6587\u4ef6\uff1a<\/p>\n<pre class=\"brush: bash; gutter: true\">string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, &quot;csv\/&quot;+configName);\r\n\t\tbyte[] result=null;\r\n\t\tif (filePath.Contains(&quot;:\/\/&quot;)) {\r\n\t\t\tWWW www = new WWW(filePath);\r\n\t\t\tyield return www;\r\n                        while(!www.isDone()){\r\n                             yield return null;\r\n                        }\r\n\t\t\tresult = www.bytes;\r\n\t\t} else {\r\n\t\t\tresult = System.IO.File.ReadAllBytes(filePath);\r\n\t\t}<\/pre>\n<p>\u5982\u679c\u5728unity\u4e2d\u60f3\u5168\u90e8\u7528www\u53d6\u6587\u4ef6<\/p>\n<pre class=\"brush: bash; gutter: true\">string filePath3 = Application.streamingAssetsPath + &quot;\/bt2\/android\/&quot;;\r\n         if (!filePath3.Contains(&quot;:\/\/&quot;))\r\n         {\r\n            filePath3 = &quot;file:\/\/\/&quot; + filePath3;\r\n         }<\/pre>\n<p>\u5728android\u4e0b\u9700\u8981\u6ce8\u610f\uff0c\u56e0\u4e3aapk\u672c\u8eab\u662f\u538b\u7f29\u683c\u5f0f\uff0c\u65e0\u6cd5\u76f4\u63a5\u7528File\u53d6\u6587\u4ef6\uff0c\u5fc5\u987b\u7528www\u53d6\u6587\u4ef6\u3002<\/p>\n<p>\u7528www\u53d6\u6587\u4ef6\u6ce8\u610f\u683c\u5f0f\uff0c\u4e00\u5b9a\u8981\u7b49www.isDone<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IEnumerator test1(){ String filePath1=Ap &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/blog.zhukunqian.com\/?p=1246\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1246"}],"collection":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1246"}],"version-history":[{"count":4,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1246\/revisions"}],"predecessor-version":[{"id":1253,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1246\/revisions\/1253"}],"wp:attachment":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}