GameObject.FindGameObjectsWithTag("Player").SendMessage("ํจ์ ๋ช
");
GameObject.FindGameObjectsWithTag("Player").GetComponent<PlayerController>();
์ธํฐ๋ท์์ ์ฐพ์๋ณด๋๊น ์์ฒ๋ผ ํ๋ฉด ๋๋ค๋๋ฐ ์๊พธย
'GameObject[]' does not contain a definition for 'SendMessage' and no accessible extension method 'SendMessage' accepting a first argument of type 'GameObject[]' could be found (are you missing a using directive or an assembly reference?)
์ด ๊ฒฝ๊ณ ๋ง ๋ฌ๋ค..
์ฌ์ค ์ฒ์์ ํจ์๊ฐ ์๋๋ผ ์๋์ฒ๋ผ ๋ค๋ฅธ ์คํฌ๋ฆฝํธ ์ ๋๋ฉ์ด์ ํธ์ถ์ ํ๊ณ ์ถ์๋๋ฐ
public GameObject enemy;
public Animator enemyAnimator;private void Start()
{
ย enemyAnimator = enemy.GetCompoent<Animator>();
ย enemyAnimator.setTrigger("***");
}
์์ฒ๋ผ ์ฐ๋ฉด ์ด๊ฒ๋ ๋๊ฐ์ ์ค๋ฅ๋ง๋ฌ๋ค
์ด๊ฑฐ ๋ฌธ์ ๊ฐ ๋ญ๊น..ย
objects๋ก ๋ฐฐ์ด๋ฐ์์ค๋๋ฐ ๋น์ฐ ์๋๋๊ฑฐ์ง~
์์ง ์ด๋ณด๋ผ ๊ทธ๋ฐ๋ฐ ์ ๊ธฐ์ ํด๊ฒฐ๋ฒ์ด ์์๊น์..?
์ด๊ฒ ๋ญ ์ฝ๋ ์ง๋ ๋ชจ๋ฅด๊ณ ๋ฌด์ง์ฑ์ผ๋ก ๋ฐ๋ผํ๋.. ๋ต๋ตํ๊ตฌ๋ง ๊ธ๊ณ ์ฅ๊ฐํ๋ฉด find๊ณ์ด ์์ฐ๋๊ฒ ์กฐ์ ํด๋น ํด๋์ค static instance ๋ง๋ค์ด์ ํธ์ถํ๋์ง ์๋๋ฉด ํด๋์ค ์ธ์คํํฐ์๋ค๊ฐ ๋์ด๋ค ์ฐ๋์ง ์ด๋ฒคํธ ์ฐ๋์ง ํ์ .
๋ต ๊ฐ์ฌํฉ๋๋ค..
ํ๋ฒ ํธ์ถํ๋๊ฑฐ๋ฉด ์จ๋ ๊ด์ฐฎ์ง์๋
๊ฑ ๋ ์ผ๋จ ๋ญ ์ค๋ช ํด์ค๋ ๋ชจ๋ฅผ๊ฑฐ ๊ฐ์ผ๋๊นFindGameObject ํ ๋ Playerํ๋๋ง ์ฐพ์๊ฑฐ๋๊น s๋ถ์๊ฑฐ ๋นผ์๊ณ , ๊ทธ๋ฆฌ๊ณ ๋ฐ์๋ GetComponent๋ถ๋ถ ์คํ ๋๊ฑฐ ๊ฐ์ผ๋๊น ๋ด๊ฒ๋ ์คํ ์๋ ์ ํ์ธํด๋ผ , ๊ธ๊ณ ์ฅ๊ฐํ๋ฉด ์ ๋ํฐ๊ฐ ์๋ฌด๋ฆฌ ์ฝ๋ค์ง๋ง ํ๋ฐ์ง์์ ์ข ๋ฏธ๋ฆฌ ์ฑ๊ฒจ๋์ ํ๋ด๋ผ
๊ฐ์ฌํฉ๋๋ค ์ด์ฌํํ ๊ฒ์
์ ๋ฆฐ์ด ใฑใ ใ