关于Resources.LoadAssetAtPath

时间:2024-05-28 10:02:50

返回的是Object,

返回所在资源路径上的一个资源,

只能应用在unity的编辑器模式下,安卓等平台无效

static function LoadAssetAtPath (assetPath : string, type : Type) : Object

assetPath 的路径要加“Assets/”:

关于Resources.LoadAssetAtPath

        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(-, , ));
go.renderer.material.mainTexture = Resources.LoadAssetAtPath<Texture2D>("Assets/LuanTangRS/train_b.gif");