๋จ์ํ ์บ ์ฐ๊ทธ๋ฌ์ง๋ ์ด๋ฏธ์ง 2๊ฐ์ง๋ฆฌ ์ ๋๋ฉ์ด์ wํค ๋๋ ์๋ ์คํํ๋๋ก ํ๋ ค๊ณ ํ๋๋ฐ ...
Animator ์ปดํฌ๋ํธ ์์ฐ๊ณ animation ์ผ๋ก๋ง์ฐ๊ณ ์ถ์๋ฐ
public class CanDisposal : MonoBehaviour
{
public Animation anim;
private void Start()
{
anim = GetComponent();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.W))
{
anim.Play("Narand_1");
Debug.Log("ํค๋ฅผ ๋๋ ์ต๋๋ค");
}
}
}
๋ก๊ทธ๋ ๋จ๋๋ฐ ์ ์ ๋๋ฉ์ด์ ์ ์คํ์ด ์๋ ๊น?? ์ด๋ฆ๋ ๊ฐ์๋ฐ ์ ๋๋ฉ์ด์ ํ์ผ์ด ์๋ชป๋๊ฑฐ ๊ฐ๊ธดํ๋ฐ..
์ ๋๋ฉ์ด์ ์ด ์ค๋ธ์ ํธ์ ๋ค์ด๊ฐ? ์ ๋๋ฉ์ดํฐ ์ปดํฌ๋ํธ ๋ฌด์กฐ๊ฑด ๋ฃ์ด์ผ ํ๋๊ฑธ๋ก ์๋๋ฐ...๋ ์ ๋๋ฉ์ดํฐ ์๋ฃ์ผ๋ฉด ๋ชปํ๋๊ฑธ๋ก ์๊ณ ์์. ๊ทธ๋ฆฌ๊ณ getcomponent์ <Animator>๋ <Animation>์ด๋ ๋ถ์ฌ์ผ ํด๋น ์ปดํฌ๋ํธ๋ฅผ ์ธ์ํ๊ฒ ์ง? ์๋ฅผ ๋ค์ด์ anim = GetComponent<Animatior>(); ์ด๋ฐ ์์ผ๋ก.