Home > other >  How to use the AssetBundle packaging and loading scenarios?
How to use the AssetBundle packaging and loading scenarios?

Time:09-22

I to save scenario to the Assets folder, named "ABTest", its AssetBundle as shown in figure change:


With the
BuildPipeline. BuildAssetBundles (" Assets/StreamingAssets, "BuildAssetBundleOptions. None, BuildTarget. StandaloneWindows);
The function package,
After completion of packaging will appear under the StreamingAssets folder four files,


Then load:
Public string sceneAssetBundle="test. Assetbundle";
Public string sceneName="ABTest";


IEnumerator Start () {
String path="file://" + Application. DataPath + "/StreamingAssets/" + sceneAssetBundle;
WWW WWW=www.LoadFromCacheOrDownload (path, 0);
Yield return WWW.
If (www.error!=null) {
AssetBundle ab=www.assetBundle;
AsyncOperation async=SceneManager. LoadSceneAsync (sceneName);
Yield return async;
} else {
The Debug Log (www.error);
}
}

The console display NULL, means scene file is not found in the bag, packing? Why is that? I should be how to solve?

Then, I use the
BuildPipeline. BuildPlayer ()
Packaging was carried out on the scene, according to the official script API example, then error, error is
The Source file ` Assets/Scene_Data/Managed/Assembly - CSharp. DLL 'is a binary file and not a text file
The official script API also prompt the script will produce has a problem, but I can't understand,,,
This road is dead,
I am afraid that should be how to package and loading scenarios?

Thank you for your help!

CodePudding user response:

Pack your baidu
Use the Resource. There is a way to Load, then instantiates a, don't forget to release

CodePudding user response:

reference 1st floor ogurishun2016 response:
packaging baidu yourself
Use the Resource. There is a way to Load, then instantiates a, don't forget to release

The Resource. The Load can obtain the Assetbundle bag?
  • Related