unity

[unity - c#] : MonoBehaviour은 왜 있는 거지?

ork_ 2022. 4. 17. 15:48

MonoBehaviour은

유니티에서 생성하는 모든 스크립트가 상속받는 기본 클래스.

 

c#에서 코드를 작성하기 위해 파일을 생성하면 아래와 같이 나온다.

public class TB : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

여기서  : MonoBehaviour은 TB안에 코드들을 원활하게 작동 시킬 수 있도록한다.

start(), update(), 등... 많은 매서드가 여기에 상속되어 있다.

 

즉, : MonoBehaviour이게 빠지면 상속되어 있는 매서드를 못 쓴다는 뜻이다.