关于Resources.LoadAssetAtPath
返回的是Object,
返回所在资源路径上的一个资源,
只能应用在unity的编辑器模式下,安卓等平台无效
static function LoadAssetAtPath (assetPath : string, type : Type) : Object
assetPath 的路径要加“Assets/”:
GameObject UI = GameObject.Instantiate(Resources.LoadAssetAtPath("Assets/LuanTangRS/LuanTangUI1.prefab",typeof(GameObject))) as GameObject; GameObject go = GameObject.CreatePrimitive(PrimitiveType.Plane); go.transform.rotation = Quaternion.Euler(new Vector3(-90, 0, 0)); go.renderer.material.mainTexture = Resources.LoadAssetAtPath<Texture2D>("Assets/LuanTangRS/train_b.gif");