Unity - FloatConversion

Published: 22 August 2019
on channel: 박만수
911
0

소수점 변환에는 항상 주의하시기 바랍니다.

두번째 블럭 -  (int) 형변환
int x = (int)(child.position.x + w * 0.5f);
int y = (int)(child.position.y + h * 0.5f);

세번째 블럭 - Mathf.RoundToInt()
int x = Mathf.RoundToInt(child.position.x + w * 0.5f);
int y = Mathf.RoundToInt(child.position.y + h * 0.5f);

정수로의 형변환이 의심스럽다면 유니티의 Mathf.RoundToInt()를 사용하는 것이 쉬운 방법 중 하나입니다. 물론 RountToInt는 가장 가까운 정수를 반환하는 것으로 의도한 방식과 다를 수 있으니 참고하시기 바랍니다.
참고)
https://docs.unity3d.com/ScriptRefere...


On this page of the site you can watch the video online Unity - FloatConversion with a duration of hours minute second in good quality, which was uploaded by the user 박만수 22 August 2019, share the link with friends and acquaintances, this video has already been watched 911 times on youtube and it was liked by 0 viewers. Enjoy your viewing!