Search Unity

Assetbundle and the streaming assets folder

Discussion in 'Editor & General Support' started by tcosta29, Jan 6, 2017.

  1. tcosta29

    tcosta29

    Joined:
    Apr 27, 2016
    Posts:
    6
    Hi there!

    I have a few assets on my streamingassets folder, and I want to make an assetbundle of them.
    Unfortunately it doesn't work, unless I create some dummy asset with the same assetbundle name outside streamingassets folder. If I do that, the bundle will be created with both streamingassets files and the dummy one.

    Is this a bug or am I doing something wrong?

    Thanks!

    Edit:
    I've been doing some testing and something's wrong with assetbundles.
    Some of my tests were made only to trying to figure out a pattern, but no success untill now.
    I've done the following tests

    Test 01
    • Create .txt file in streamingassets folder
    • Create a new assetbundle name and extension for that file
    • Export the assetBundle​

    After this I get the message "Unrecognized assets cannot be included in AssetBundles: "Assets/StreamingAssets/Txt/SomeText.txt".

    Test 02
    • Create .txt file in resources folder
    • Create a new assetbundle name and extension for that file
    • Export the assetBundle
    After this I get the message "Unrecognized assets cannot be included in AssetBundles: "Assets/Resources/Txt/SomeText.txt".

    Test 03
    • Create .txt file in both folders
    • Create a new assetbundle name and extension for that file
    • Export the assetBundle
    Test 04
    • Create .txt file in resources folder
    • Create a .jpg file in resources folder
    • Create a new assetbundle name and extension for that file
    • Export the assetBundle​

    It worked. Both files were exported in that assetbundle. And it's strange right? So I've done one more test. I repeated test 03, that failed in the last time and it worked, one time... As soon as I added another file to the bundle it went back to the warning message "Unrecognized assets cannot be included in AssetBundles: "Assets/Resources/Txt/SomeText.txt".

    If someone has a solution for this, I would gladly appreciate your help.

    Edit 2 :

    I've also tried this with xml files and the result was the same
    Also I'm using Unity 5.5
     
    Last edited: Jan 6, 2017
  2. LuKenn

    LuKenn

    Joined:
    Jun 25, 2016
    Posts:
    2
    I've been trying wrap my head around this for the last 2-3 days too.

    I recently upgraded to 5.5.0f3, and all the previous commands have been made obsolete. I've read through pages of documentation, and even looked at a whole bunch of tutorials/youtube and haven't had any progress.

    Any kind soul out there with a solution ?
     
  3. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    I may be misunderstanding, but what's your use case?
    As far as I know assets in the StreamingAssets folder are not imported and therefore cannot be included in AssetBundles.
    If you simply move whatever assets you have in StreamingAssets to another folder in your project then build them into an AssetBundle that should work fine.
     
  4. tcosta29

    tcosta29

    Joined:
    Apr 27, 2016
    Posts:
    6
    Well that may be true, although there's no documentation saying that you can't use the streamingassets folder whatsoever, also if the asset has the option to be imported into an assetbundle, then it should work(and it works if I add some dummy .jpg file from the resources).
    Anyway the problem here is that I can't really create an assetbundle using .txt files with streamingassets folder nor with the resources folder (well with the .jpg dummy file it builds the assetbundle with the .txt and the .jpg files).
     
  5. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    All that may be true, but is there a reason you need your AssetBundles to be built from StreamingAssets or Resources? These are not the correct places for an asset to be if it's going to be built in an AssetBundle as they will get included in the build.
    I'd suggest you move your assets to another folder, then you can place your built AssetBundles in StreamingAssets (or web server).
     
  6. tcosta29

    tcosta29

    Joined:
    Apr 27, 2016
    Posts:
    6
    Yes there's a reason for that.
    We have this multi platform project, and in most platforms we use the StreamingAssets folder in order to do partial updates(the project has more than 10k files).
    Right now we're trying to port this to webgl, and we're starting to use AssetBundles for some assets(because it's better for webgl). But since we don't use AssetBundles on the others platforms, we need to build them from the StreamingAssets folder. We can't just move around files every time we want to update or make a new build. It's not productive.
     
  7. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    70
    Sorry to necro this thread but did you ever figure this out? I'm running into similar issues while trying to be cross-platformable.
     
unityunity