Hello,
I’m trying to use Facebook SDK 360 for ambisonic sound. At Mac it works fine, but when I try to play at Android devices doesn’t works. Now I know that the problem is the path for load the audio. Facebook 360 SDK use StreamingAssets to save there a .tbe archive, and Unity has little problems to load StreamingAssets as PC/Mac.
The default code is this
private string resolvePath(string path, PathType type)
{
if (type == PathType.STREAMING_ASSETS)
{
string streamingAssetsPath = Path.Combine(Application.streamingAssetsPath, path);
if (streamingAssetsPath.Contains("apk!") && Application.platform == RuntimePlatform.Android)
{
return "asset:///" + Path.GetFileName(streamingAssetsPath);
}
return streamingAssetsPath;
}
return path;
}
I try to use WWW as Unity say and I made this another code:
private string resolvePath(string path, PathType type)
{
Debug.Log("WWWWWQW!");
string streamingAssetsPath = Path.Combine(Application.streamingAssetsPath, path);
if(!Application.isEditor)
{
string dbPath;
WWW reader = new WWW(streamingAssetsPath);
while (!reader.isDone)
{
}
string realPath = Application.persistentDataPath + path;
System.IO.File.WriteAllBytes(realPath,reader.bytes);
dbPath = realPath;
streamingAssetsPath = dbPath;
}
return streamingAssetsPath;
}
It worked once, but now the app doesn’t load nothing T.T
Does anyone have any suggestion to make it work?
Thanks in advance