Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.IO;
- public class LoadFromFileExample : MonoBehaviour {
- // Use this for initialization
- void Start () {
- var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath , "assetbundle.unity3d"));
- if (myLoadedAssetBundle == null)
- {
- Debug.Log("Failed to load AssetBundle!");
- return;
- }
- var prefab = myLoadedAssetBundle.LoadAsset< GameObject > ("prefab name");
- Instantiate(prefab);
- }
- // Update is called once per frame
- void Update () {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement