一、内部调用
1.Resources.Load("path","type");或Resources.LoadAll("path","type");
加载储存在Resources文件夹中path处的资源,必须忽略后缀名。
GameObject instance = Instantiate(Resources.Load("enemy", typeof(GameObject)));
2.Resources.LoadAssetAtPath("assetPath","type");
返回所在资源路径上的一个资源(编辑器仅仅)。
注意:所有资源名字和路径在Unity是带有正斜杠,如果在路径中使用反斜杠,将获得错误。
prefab = Resources.LoadAssetAtPath("Assets/Artwork/mymodel.fbx", typeof(GameObject));
二、外部调用
1.Assetbundle
http://blog.csdn.net/wsc122181582/article/details/50731897
2.WWW
public string url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg"; IEnumerator Start() { WWW www = new WWW(url); yield return www; Renderer renderer = GetComponent<Renderer>(); renderer.material.mainTexture = www.texture; }注意:
1.地址注意回避%符号
2.支持http://, https://, file://, ftp:// 等协议