Hi all, I have big problems to load manifest to find dependencies. I try to load a bundle "city.hdgermany" which have a dependence to bundle "datas", I follow the doc to load manifest ( even with half of doc obsolete) with this code from https://docs.unity3d.com/Manual/AssetBundles-Native.html Code (CSharp): var uri = Application.streamingAssetsPath + "/" + DataAssetBundle; AssetBundle assetBundleDatas = AssetBundle.LoadFromFile(uri); uri = Application.streamingAssetsPath + "/" + MainAssetBundle; var assetBundle = AssetBundle.LoadFromFile(uri); AssetBundleManifest manifest; { manifest = assetBundle.LoadAsset<AssetBundleManifest>(MainAssetBundle + ".manifest"); // or AssetBundleManifest same result } string[] dependencies = manifest.GetAllDependencies(MainAssetBundle); //Pass the name of the bundle you want the dependencies for. foreach (string dependency in dependencies) { Debug.Log(dependency); } yield break; } #region Variables private const string MainAssetBundle = "city.hdgermany"; private const string DataAssetBundle = "datas"; #endregion manifest is always null .... Also manifest cannot be used with scene streaming assetbundle ? so how do you know dependencies ? Thks for help !
When you generate AssetBundles, the manifest object gets put into its own bundle, which will be named after the folder the AssetBundles got built to. So if you built to a folder called "MyAssets", you'd have all your bundles, plus one called "MyAssets". In your case it looks like you've got them directly in StreamingAssets, so if that's where you built to you'll have a bundle file called "StreamingAssets". This bundle should be loaded separately - It contains exactly one asset, called "assetbundlemanifest", which is the AssetBundleManifest object. So you'd need something like: Code (CSharp): var manifestUri = Application.streamingAssetsPath + "/StreamingAssets"; var manifestBundle = AssetBundle.LoadFromFile(manifestUri); AssetBundleManifest manifest = manifestBundle.LoadAsset<AssetBundleManifest>("assetbundlemanifest"); // Now you can do stuff with the manifest (replace "/StreamingAssets" with whatever your manifest bundle file is called)
When you generate AssetBundles, the manifest object gets put into its own bundle, which will be named after the folder the AssetBundles got built to. So if you built to a folder called "MyAssets", you'd have all your bundles, plus one called "MyAssets". In your case it looks like you've got them directly in StreamingAssets, so if that's where you built to you'll have a bundle file called "StreamingAssets". This bundle should be loaded separately - It contains exactly one asset, called "assetbundlemanifest", which is the AssetBundleManifest object. 이건 거의 뭐 예수님의 답변이다. 할렐루야! FolderName의 AssetBundle에 접근해야 한다는 답변은 이게 유일하다. 왜 제대로 받아온 AssetBundle 내부에 AssetBundleManifest가 존재하지 않고 널 에러가 나는지, 도대체 AssetBundleManifest가 '어디에' 있는지 조차 몰랐는데 한 번에 해결했다. AssetBundleManifest를 가져와야 할 목적지 자체가 달랐다는 것을 이 Human Navigation이 잘 설명해주었습니다. 이 사람이 절벽을 향해 돌진하는 내 핸들을 꺾어서 목숨을 살렸습니다. Thank you sir.