Last active
October 30, 2019 13:41
-
-
Save ssabii/57eee41acfb71c1301942aa6c43e2b93 to your computer and use it in GitHub Desktop.
파일을 읽어서 에셋번들 로드하는 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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