์ง๊ธ ํ๋ ค๊ณ ํ๋๊ฒ ๋์ ์ผ๋ก ๋จธํ ๋ฆฌ์ผ ์์ฑํด์ ์ธํ ํ๋ ๋ถ๋ถ์ด๊ณ
์ฝ๋๋ ๋๊ฐ ๋ค์๊ณผ ๊ฐ์
class MyObject : MonoBehavior
{
void LoadMaterial(string TextureName)
{
string texturePath = "Textures/"+TextureName+".png";
gameObject.GetCompont<Renderer>().material = new Material(Shader.Find(texturePath));
}
}
๋ด๊ฐ ์ง๊ธ Shader.find๋ฅผ ์ฒ์ ์จ๋ด์ ์ ๋ชจ๋ฅด๋๋ฐ ์ง๊ธ Textures/~~.png๊ฐ Resources์๋์ ์๊ฒ ํด๋จ๊ฑฐ๋ ?
์ด๋ ๊ฒ ํ๋ฉด ์ ์๋๋ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์ฐ๋๊ฒ ๋ง๋๊ฑฐ์ผ....?
๋๊ธ 0