상세 컨텐츠

본문 제목

Unity Basic ch. 19] 함수 주기

Unity Basic/04. Unity Basic 마무리

by allma 2020. 5. 4. 22:58

본문

Unity가 스크립트 수명 동안 이벤트를 주문하고 방법하는 방법이 있다.

 

https://docs.unity3d.com/Manual/ExecutionOrder.html

 

Unity - Manual: Order of Execution for Event Functions

Understanding Automatic Memory Management Order of Execution for Event Functions Running a Unity script executes a number of event functions in a predetermined order. This page describes those event functions and explains how they fit into the execution se

docs.unity3d.com

 

자세한 내용은 유니티에서 제공하는 설명서를 참고하고,

 

간단히 보면 아래와 같다.

 

void OnEnable() //활성화 - 초기화와 물리엔진사이

 

void Awake(){} //처음 시작

void Start(){} //초기화 영역

void FixedUpdate() {} // Update() 하기전에 물리 연산 로직 주는 부분 1초에 50번 실행

void Update(){} // 물리 연산을 제외한 update() 초에 60프레임

void Lateupdate(){} // 카메라나 후처리해주는 곳

void OnDestroy() {} //오브젝트가 삭제될 때 실행//뭔가 남기고 종료

 

void Ondisable() //비활성화 - 게임로직,해체사이