WJ의 개인블로그
Unity. 2D기초 Camera follow 본문
2D Camera follow 기초
GameObject player;
void Start()
{
player = GameObject.Find("Player");
}
void Update()
{
Vector3 playerPos = player.transform.position;
transform.position = new Vector3(playerPos.x, playerPos.y + 2, transform.position.z);
}
'Unity > Unity 기초' 카테고리의 다른 글
Unity. 2DCamera follow 기초2 (0) | 2019.01.22 |
---|---|
Unity.오브젝트 사이클 (0) | 2019.01.18 |