Hi,
Doing some OBB-related testing with a couple of minimal, barebone scenes. Could anyone give us pointers as to why the following script (based on DownloadOBBExample included in Unity’s plugin intended for OBB use) works in some Android devices (e.g. Huawei Honor 7, Samsung Trend+), but not in some others (e.g. Huawei P7 Lite)?
We have a test app in Google Play Store and in the devices where it works, the simple scene 1 opens after you press the button (referred to in the script), but in some other devices the scene does not open. Any pointers are highly appreciated as we don’t have any expertise for this kind of issue.
The script:
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class DownloadObbExample : MonoBehaviour
{
string mainPath = "";
void OnGUI()
{
if (!GooglePlayDownloader.RunningOnAndroid())
{
GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Use GooglePlayDownloader only on Android device!");
return;
}
string expPath = GooglePlayDownloader.GetExpansionFilePath();
if (expPath == null)
{
GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "External storage is not available!");
}
else
{
mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath);
GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length)));
GUI.Label(new Rect(10, 25, Screen.width - 10, 20), "Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length)));
if (mainPath == null || patchPath == null)
if (GUI.Button(new Rect(10, 100, 100, 100), "Move to scene 1"))
StartCoroutine(loadLevel());
}
}
void Update()
{
}
protected IEnumerator loadLevel()
{
string uri = "file://" + mainPath;
WWW www = WWW.LoadFromCacheOrDownload(uri, 0);
yield return www;
if (www.error != null)
{
// log("wwww error " + www.error);
}
else
{
SceneManager.LoadScene("Test");
}
}
}