我有一些我们自动为单位5.6创建的资产捆绑巫婆,其中的任何资产预算都在其中包含一个游戏对象。
我的示例资产:c6f97739ec43264ef3bfae7b1dc55e88.unity3d
链接:https://www.file-up.org/891dtdi54n0l
因此,我们已经使用assetBundle.mainAsset访问该游戏对象。但在统一2018.3中,assetBundle.mainAsset已过时。
我阅读了统一文件,他们说使用
LoadAsset<GameObject>(name);
具有名称或类型!但是当我创建资产包时,我不知道要访问它的游戏对象名称。
我尝试使用:myLoadedAssetBundle.GetAllAssetNames()[0])加载它。
void LoadAssetBundle(string bundleUrl)
{
myLoadedAssetBundle = AssetBundle.LoadFromFile(bundleUrl);
Debug.Log(myLoadedAssetBundle == null ? "Faild To Load" : "Succesfully Loaded!");
Debug.Log(myLoadedAssetBundle.LoadAsset(myLoadedAssetBundle.GetAllAssetNames()[0]));
GameObject prefab = myLoadedAssetBundle.LoadAsset<GameObject>(myLoadedAssetBundle.GetAllAssetNames()[0]);
Instantiate(prefab);
myLoadedAssetBundle.Unload(true);
}
我的问题是:
1-我如何用新的Assetbundle统一系统将主要资产加载到我的Assetbundle中,具有任何类型的游戏对象,例如Sprite,obj,Sound,Video等。>
also
2-我不知道如何实例化加载的资产?
我有一些我们会自动为单位5.6创建的资产捆绑巫婆,其中任何资产预算都在其中包含一个游戏对象。我的示例资产:c6f97739ec43264ef3bfae7b1dc55e88.unity3d链接:https:// ...
1-我如何用新的Assetbundle统一系统加载主要资产,而我的Assetbundle具有任何类型的游戏对象,例如:精灵,obj,声音,视频等。>