- 【3Dゲームエンジン】Unity 2
332 :293[sage]:2011/01/21(金) 11:11:05 ID:nX/PFrk5 - やっとFBXをResourcesフォルダーから出せたので、報告。(C#)
//外部FBXのスポーン private GameObject obj; string FBXFileName="Corn"; obj = Resources.Load(FBXFileName) as GameObject; Instantiate(obj, Vector3.zero, Quaternion.identity); obj.transform.localScale = new Vector3(100, 100, 100); obj.name = "HelloCorn"; あとは、おまけ 画像 private Texture2D ImageTex; string ImageFileName="title"; ImageTex = Resources.Load(ImageFileName, typeof(Texture2D)) as Texture2D; サウンド private AudioClip mySound; string SoundFileName="bgm"; mySound = Resources.Load(SoundFileName, typeof(AudioClip)) as AudioClip; シェーダ private Material newMat; string MaterialFileName="stone"; newMat = Resources.Load(MaterialFileName, typeof(Material)) as Material; renderer.material = newMat; お目汚し失礼しました。
|
|