Skip to content

Instantly share code, notes, and snippets.

@ssabii
Last active October 30, 2019 13:41
Show Gist options
  • Save ssabii/57eee41acfb71c1301942aa6c43e2b93 to your computer and use it in GitHub Desktop.
Save ssabii/57eee41acfb71c1301942aa6c43e2b93 to your computer and use it in GitHub Desktop.
파일을 읽어서 에셋번들 로드하는 코드
using System.IO;
using UnityEngine;
public class LoadAssetBundleFromFile : MonoBehaviour {
// Use this for initialization
void Start()
{
AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Application.dataPath + "/AssetBundles", "bundle"));
if (bundle == null)
{
Debug.Log("Failed to load AssetBundle!");
return;
}
var prefab = bundle.LoadAsset<GameObject>("Stone");
Instantiate(prefab);
prefab = bundle.LoadAsset<GameObject>("Brick");
Instantiate(prefab);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment