using UnityEngine.UI; // 버튼 사용하려면 2019.3.7
public class App : MonoBehaviour
{
public GameObject model; //구멍을 뚫어
public Button btn; // 버튼 인스턴스
> 버튼 클릭시 리스너
this.btn.onClick.AddListener(메소드());
this.btn.onClick.AddListener(() =>
{
Debug.Log("test1");
});
> 프레임 시간
timer += Time.deltaTime;
> 애니메이션 컴포넌트 먼저가져와야함(model은 GameObaect)
var anim = this.model.GetComponent<Animation>(); // 애니 컴포넌트 가져와
> 애니메이션
var state = anim["attack_sword_01"]; // 애니메이션 컴포넌트 활용
anim.Play("attack_sword_01"); //애니메이션 실행
'c# 강의 > 유니티' 카테고리의 다른 글
20200507 - 오브젝트 생성 및 부모설정(Instantiate) (0) | 2020.05.08 |
---|---|
20200507 - 애니메이션2 (0) | 2020.05.08 |
20200507 - 유니티(MonoBehaviour), 라이프사이클 (0) | 2020.05.07 |
20200506 - 설정2 (0) | 2020.05.06 |
20200506 - 설정1 (0) | 2020.05.06 |