动态加载模型贴图代码
方法有两种
第一种:Resources.Load
// Assigns a texture named "Assets/Resources/glass" to a Plane.
function Start () {
var go = new GameObject.CreatePrimitive(PrimitiveType.Plane);
go.renderer.material.mainTexture = Resources.Load("glass");
}
// Instantiates a prefab at the path "Assets/Resources/enemy".
function Start () {
var instance : GameObject = Instantiate(Resources.Load("enemy"));
}
Resource文件夹中一定有glass贴图跟enemy物体及模型
第二种:AssetBundlefunction Start () {
var www = new WWW ("http://192.168.1.106/myBundle.unity3d");
yield www;
// Get the designated main asset and instantiate it.
Instantiate(www.assetBundle.mainAsset);
}生成.unity3d的格式的 Assets-Build AseetsBundel
真是好东西哦,希望能下载 {:5_401:}GOOD! 很不错 楼主是超人 真心顶 很好哦 不错不错 楼主是超人 好帖就是要顶
页:
[1]