- Home /
Already fixed.
Streaming Assets Path working on Windows but not on Android.
I've been working with unityGB as a way to implement my own .gb to make an Android app. I've also had many other problems with switching the key inputs to buttons, but that's already fixed. Is there a way I can get the .gb file displayed on screen for Android? (With Unity Remotes works perfectly, but not the apk by itself.) Also, I think the problem is in the first 10 lines or so.
private IEnumerator LoadRom(string filename)
{
string path = ("jar:file://" + Application.streamingAssetsPath + "!/assets" + filename);
Debug.Log("Loading ROM from " + path + ".");
if (!File.Exists(path))
{
Debug.LogError("File couldn't be found.");
yield break;
}
WWW www = new WWW("jar:file://" + path);
yield return www;
if (string.IsNullOrEmpty(www.error))
{
Emulator.LoadRom(www.bytes);
StartCoroutine(Run());
}
else
Debug.LogError("Error during loading the ROM.\n" + www.error);
}
Answer by Bunny83 · Sep 26, 2019 at 05:35 PM
"File.Exists" just makes no sense with the special "jar" URI. That "path" is not a file on the file system. It's essentially an URI to a resource within the compressed APK / zip file. The only one who can understand that special URI is the WWW class or the UnityWebRequest.
It seems all your introductory text about the Unity Remote / input / unityGB is completely irrelevant to your question title and the actual problem. Also it's generally more helpful if you go a bit more in detail what is "not working". In your case it's pretty obvious, though questions should be explicit about the actual issue.
Follow this Question
Related Questions
Problem with the android emulator "Device hardware is not supported" 2 Answers
[Android] Using Bluestacks with unity 1 Answer
Configuring android virtual device for Unity 1 Answer
Running apps on an Android virtual device 1 Answer
Build and Unity look different.,Build looks different to Scene/Game view 1 Answer