Created
October 9, 2016 09:25
-
-
Save zhenlinyang/55c167fc388024447d0ac145e34905f9 to your computer and use it in GitHub Desktop.
Use StreamingAssets in Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerator CopyVersion() | |
{ | |
string _Version_txt_streamingAssetsPath = PathConf.VCRoot + "Version.txt"; | |
if (_Version_txt_streamingAssetsPath.Contains("://")) | |
{ | |
using (WWW www = new WWW(_Version_txt_streamingAssetsPath)) | |
{ | |
yield return www; | |
if (!string.IsNullOrEmpty(www.error)) | |
{ | |
yield return null; | |
StartCoroutine(CopyVersion()); | |
yield break; | |
} | |
File.WriteAllBytes(m_Version_txt_Path, www.bytes); | |
} | |
} | |
else | |
{ | |
File.Copy(_Version_txt_streamingAssetsPath, m_Version_txt_Path, true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment