Android and AssetBundle LoadFromFile


I use AssetBundle.LoadFromFile() to load AssetBundle.
On my computer it’s ok, but when I compile with Android and try same thing on my phone, asset bundle is not load.

  • On Computer : AssetBundle.LoadFromFile(C:/Users/toto/AppData/LocalLow/myCompany/Unity Test AR/AssetBundles/test.lot1)

  • On phone : AssetBundle.LoadFromFile(/Storage/Emulated/0/Android/data/com.myCompany.testAR

When I go on my phone Folder explorer , file “test.lot1” is in “/Android/data/com.myCompany.testAR/files/AssetBundles/” folder.

Directory.GetFiles(dirAssetBundleLocal) return me all files in “dirAssetBundleLocal” directory on computer and phone.
Did I need specific authorisation on phone to read file ?

I found the problem.

it’s come from my build AssetBundle.
I just need to use BuildTarget.Android option :slight_smile:

An example of my function to generate assetbundle for my computer or phone :

public class AssetBundleCreator : MonoBehaviour {

	[MenuItem ("Assets/Build Asset Bundle standalone")]
    static void BuildBundles_standalone()
        BuildPipeline.BuildAssetBundles("Assets/AssetBundles/Standalone_AssetBundles", BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
    [MenuItem("Assets/Build Asset Bundle android")]
    static void BuildBundles_android()
        BuildPipeline.BuildAssetBundles("Assets/AssetBundles/Android_AssetBundles", BuildAssetBundleOptions.None, BuildTarget.Android);