2024-05-10 TIL

조창일·2024년 5월 10일

내배캠

목록 보기
19/51
post-thumbnail

맵 만들기

더 꾸미는 건 구현 다해보고 시간 남으면...

LateUpdate()

모든 Update 함수가 호출된 후, 마지막으로 호출된다. 주로 오브젝트를 따라가게 설정한 카메라는 LateUpdate를 사용한다(카메라가 따라가는 오브젝트가 Update하수 안에서 움직일 경우가 있기 때문).

public class CameraManager : MonoBehaviour
{
    public Transform target;

    void LateUpdate()
    {
        transform.position = new Vector3(target.position.x, target.position.y, -10f);
    }
}
profile
안녕하세요.

0개의 댓글