Component
Use Components | Unity Manual
Component | Scripting API
Component: GameObject에 기능을 부여하는 단위. class다. component를 이용해 gameobject에 여러 기능을 부여할 수 있다. (rigidbody, collider, audio source etc.) component는 inspector 창을 통해 추가가 가능하다.
- Add component를 통해 inspector창에 추가
- script를 inspector 창에 끌어다가 놓을 수 있다.
- scipt의 경우에는 Add component 창에 script명을 쓰면 생성할 수 있음
(You can use different components to change or add functions to your GameObjects.)
property: component 항목. component 항목에는 두 가지 타입이 존재.
- values
- reference
property를 조절해서 copmponent의 속성에 변화를 줄 수가 있다.
- Script component: MonoBehaviour 클래스를 상속 받아야 한다! (물론 Unity Engine에 들어가는 모든 c# 스크립트에 MonoBehaviour를 상속 받아야 하는 것은 아니다.)
+)
AddComponent: component 추가
GetComponent: component 가져오기
Destroy(Object obj, float t) : component 삭제