Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by helios · Jul 08, 2013 at 05:13 AM · iosstreamingassets

iOS won't load streaming asset

Hello, I'm having a bit of trouble loading a file from the StreamingAssets folder on iOS. I have an asset named 'level2a' located in Assets/StreamingAssets. All I am doing is:

 var path = new GoSpline( "level2a" );

I get a runtime error on the iOS device telling me that the file could not be found at "xxx/xxx/xxx/Data/Raw/level2a". This works perfectly fine in the editor. I have also tried:

 var path = new GoSpline( Path.Combine(Application.streamingAssetsPath, "level2a"));

and I get the same error. Anyone have any idea what's going on here and how to get this to work? Thanks!

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Psymon · Jul 08, 2013 at 01:52 PM 1
Share

It sounds silly but did you check if level2 is currently in the Data/Raw/ folder ?

avatar image helios · Jul 08, 2013 at 02:38 PM 0
Share

In the Unity project? The file is in Assets/Strea$$anonymous$$gAssets. Where else would I need to physically place it? I thought unity automatically bundles it in the correct path.

avatar image Psymon · Jul 08, 2013 at 03:02 PM 0
Share

Unity copy all your Strea$$anonymous$$gAssets in your Xcode Project in the Data/Raw folder beside your Unity.xcodeproj.

But according to the documentation ( http://docs.unity3d.com/Documentation/$$anonymous$$anual/Strea$$anonymous$$gAssets.html ) Your path should be Application.dataPath + "/Raw/level2a"

avatar image helios · Jul 09, 2013 at 12:15 AM 0
Share

Yes, Unity properly copied the file there (I see it in the Data/Raw folder) and even when I try Application.dataPath + "/Raw/level2a" it still gives me the file not found error. Ugh.

avatar image Psymon · Jul 09, 2013 at 07:57 AM 1
Share

Can you try this one : path = Path.Combine(Path.Combine(Application.dataPath, "Raw"), pathAssetName);

I don't have Go$$anonymous$$it so i can't test but it seems to work for others users.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by helios · Jul 11, 2013 at 03:24 AM

Ok, THAT was really frustrating. It was a freaking typo the whole time. I was referencing "Level2a" instead of "level2a". Apparently it is case sensitive on iOS, but not in the editor which is why it was working in there. Doh.. Thanks for all the help though, guys.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abeldantas · Nov 11, 2013 at 10:34 PM 0
Share

yeah, the same happened to me

avatar image stevethorne · Aug 20, 2014 at 07:50 PM 1
Share

This saved me so much hunting, my issue boiled down to this and I was going nuts. When I came across this post I figured it had nothing to do with my issue, but I decided to check the case of my path anyways, sure enough, that was it! How aggrivating!

avatar image fuck-unity · May 31, 2018 at 03:25 AM 1
Share

Thank you guys, I have the samo problem

avatar image
2

Answer by Graham-Dunnett · Jul 10, 2013 at 10:50 AM

Try this:

 using UnityEngine;
 using System;
 using System.IO;
 
 public class filebrowser : MonoBehaviour {
 
     void ProcessFolder(string f) {
 
         Debug.Log("Folder: " + f);
             
         var txtFiles = Directory.GetFiles(f);
         foreach (string currentFile in txtFiles) {
             Debug.Log("File: " + currentFile);
         }
 
         string[] subs = Directory.GetDirectories(f);
         foreach(string sub in subs)
             ProcessFolder(sub);
             
     }
     
     // Use this for initialization
     void Start () {
         ProcessFolder(Application.dataPath);
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 }

Drop that onto your camera, then when the game starts up it'll iterate over the folder and subfolders from the Application data folder, and show you what is actually on the device. You can then use this to determine whether your asset is actually getting copied onto the phone or not. If it is there, then it would be odd to get a error when you try to access the file.

My results look like:

 Folder: /var/mobile/Applications/{GUID}/test.app/Data
 File: /var/mobile/Applications/{GUID}/test.app/Data/PlayerConnectionConfigFile
 File: /var/mobile/Applications/{GUID}/test.app/Data/mainData
 File: /var/mobile/Applications/{GUID}/test.app/Data/sharedassets0.assets
 File: /var/mobile/Applications/{GUID}/test.app/Data/unity default resources
 
 Folder: /var/mobile/Applications/{GUID}/test.app/Data/Managed
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/Assembly-CSharp.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/Assembly-UnityScript.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/Assembly-UnityScript.dll.mdb
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/Boo.Lang.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/Mono.Security.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/Mono.Security.dll.mdb
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/System.Core.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/System.Core.dll.mdb
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/System.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/System.dll.mdb
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/UnityEngine.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/mscorlib.dll
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/mscorlib.dll.mdb
 
 Folder: /var/mobile/Applications/{GUID}/test.app/Data/Managed/mono
 
 Folder: /var/mobile/Applications/{GUID}/test.app/Data/Managed/mono/2.0
 File: /var/mobile/Applications/{GUID}/test.app/Data/Managed/mono/2.0/machine.config
 
 Folder: /var/mobile/Applications/{GUID}/test.app/Data/Raw
 File: /var/mobile/Applications/{GUID}/test.app/Data/Raw/test.txt

Note at the bottom of that list, you can see that there is a file called test.txt in the Raw folder. That test.txt is there because it exists in the StreamingAssets folder in my Unity project.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image smoggach · Aug 05, 2014 at 06:48 PM 0
Share

Hi, I was having the same problem so I went ahead and tried this. It's showing all the files are definitely on the device and in the correct location. However I still get file not found at that url. I'm using the application to construct the path. The only part I add myself is "file:/" at the beginning so that I avoid the "unsupported URL" error because I'm using WWW.

$$anonymous$$y url looks something like this:

file://var/mobile/Applications/{GUID}/my.app/Data/Raw/bundle.unity3d

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

iOS use WWW to access StreamingAssets get erro 1009 1 Answer

Store downloaded images to streemingassets folder Android/Ios 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

HandHeld video compression setting doesn't work in editor? 1 Answer

Application.dataPath + "/Raw" not loading texture on iOS? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges