Skip to content

Instantly share code, notes, and snippets.

@zhenlinyang
Created October 9, 2016 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhenlinyang/55c167fc388024447d0ac145e34905f9 to your computer and use it in GitHub Desktop.
Save zhenlinyang/55c167fc388024447d0ac145e34905f9 to your computer and use it in GitHub Desktop.
Use StreamingAssets in Unity
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