Hello, everyone!
My Android game app size is more than 80 MB which I want to reduce through the Asset bundle.
But the problem is that my assets bundle loaded only one time and I want to load it many times.
Please Help Me!
Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadAssetBundles : MonoBehaviour
{
AssetBundle myLoadedAssetbundle;
public string path;
public string colom1;
void Start()
{
LoadAssetBundle(path);
InstantiateSceneFromBundle(colom1);
}
void LoadAssetBundle(string bundleUrl)
{
myLoadedAssetbundle = AssetBundle.LoadFromFile(bundleUrl);
Debug.Log(myLoadedAssetbundle == null ? "Failed to load AssetBundle" : "AssetBundle succesfully loaded");
}
void InstantiateSceneFromBundle(string assetName)
{
var prefab = myLoadedAssetbundle.LoadAsset(assetName);
Instantiate(prefab);
}
}