LateUpdate
서술
만약 유니티의 MonoBehaviour가 사용 가능하다면, 상속된 LateUpdate 함수는 모든 프레임에서 호출됩니다.
LateUpdate 함수는 스크립트 실행을 지시하기 유용합니다.
예제로 캐릭터를 따라다니는 카메라는 항상 LateUpdate 함수 안에서 수행되어야 합니다.
왜냐하면, Follow Camera는 Update함수 안에서 과거의 상태에서 현재 상태에서 움직였을지도 모르는 오브젝트의 경로를 추적합니다.
Description
LateUpdate is called every frame, if the Behaviour is enabled.
LateUpdate is called after all Update functions have been called. This is useful to order script execution. For example a follow camera should always be implemented in LateUpdate because it tracks objects that might have moved inside Update.
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void LateUpdate() {
transform.Translate(0, 0, Time.deltaTime * 1);
}
}
LateUpdate함수가 늦게 불려진 이후로 경과시간이 지나게 되면, Time.deltaTime을 사용할 수 있습니다.
이 함수는 단지 MonoBehaviour가 사용 가능한 때만 호출되어 집니다.
이 함수를 사용자님의 컴포넌트가 사용가능한 것을 제공해주는 함수에서 재정의하면 됩니다.
In order to get the elapsed time since last call to LateUpdate, use Time.deltaTime. This function is only called if the Behaviour is enabled. Override this function in order to provide your component's functionality.
'Unity > C# 언어' 카테고리의 다른 글
하얀소닉 코드 선언 방식 가이드라인 참조 (0) | 2015.11.11 |
---|---|
generic class serialization Unity3d (0) | 2014.12.25 |
Mathf.Sin, Mathf.Cos Mathf.Deg2Rad, 삼각함수 디버깅 (0) | 2014.04.14 |
pow 제곱 연산 (0) | 2014.04.04 |