라벨이 unity인 게시물 표시

유니티 애드몹 하단 배너 높이 DP 를 Pixel 로 변환하기

애드몹 하단 배너를 넣었을 때 DP 기준으로 삽입되기 때문에 디바이스마다 Pixel값이 달라 지게 된다. Pixel 값을 계산해서 내 UI가 애드몹 하단 배너에 가리지 않도록 해보자.     public float DPToPixel(float fFixedResoulutionHeight, float fdpHeight)     {         float fNowDpi = (Screen.dpi * fFixedResoulutionHeight) / Screen.height;         float scale = fNowDpi / 160;         float pixel = fdpHeight * scale;         return pixel;     } fFixedResoulutionHeight 내가 고정한 해상도 높이 (720x1280으로 고정했다면 1280) fdpHeight 바꾸고자 하는 dp (애드몹 배너 320x50일 때 50) 내 UI(버튼, 이미지...)를 하단에서 리턴 된 픽셀 값만큼 올려서 UI가 가리지 않게 할 수 있다.

유니티 카메라 월드포지션 -> 캔버스 포지션

World Position to Canvas Position     //월드 포지션 -> 캔버스 포지션     public Vector2 WorldToCanvasPosition(Camera cam, Vector3 worldPos, RectTransform canvasRect)     {         Vector2 ViewportPosition = cam.WorldToViewportPoint(worldPos);             Vector2 WorldObject_CanvasPosition = new Vector2(                  ((ViewportPosition.x * canvasRect.sizeDelta.x) - (canvasRect.sizeDelta.x * 0.5f)),               ((ViewportPosition.y * canvasRect.sizeDelta.y) - (canvasRect.sizeDelta.y * 0.5f)));              return WorldObject_CanvasPosition;     }

유니티 UGUI Text 자간 조절하기

이미지
유니티 UGUI Text 자간 조절하는 법 깃허브 주소 링크 Text 컴포넌트 아래에 LetterSpacing.cs를 추가해준다. #if UNITY_5_3 두군데를 현재 사용하는 유니티 버전에 맞게 수정해준다. 예) #if UNITY_5_6, #if UNITY_2018_1_3 ... 인스펙터 창에서 Spacing을 적절하게 수정해주면 된다. 파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있음

유니티 애드몹 테스트 광고 내보내기

이미지
애드몹 테스트 광고 내보내기 전에는 테스트 디바이스를 등록했었지만 이제는 테스트 광고 아이디만 써주면 됩니다. ANDROID IOS Ad format Sample ad unit ID Banner ca-app-pub-3940256099942544/6300978111 Interstitial ca-app-pub-3940256099942544/1033173712 Rewarded Video ca-app-pub-3940256099942544/5224354917 Native Advanced ca-app-pub-3940256099942544/2247696110 ANDROID IOS Ad format Sample ad unit ID Banner ca-app-pub-3940256099942544/2934735716 Interstitial ca-app-pub-3940256099942544/4411468910 Rewarded Video ca-app-pub-3940256099942544/1712485313 Native Advanced ca-app-pub-3940256099942544/3986624511 참조 :  https://developers.google.com/admob/unity/test-ads

유니티 네이티브 사진 플러그인 안드로이드, IOS

Unity Native Gallery Plugin 사진찍고 갤러리 갱신하고 아주 잘됩니다. 에셋스토어 링크 깃허브 링크

유니티 UGUI 스크롤 객체 버튼이 잘 안눌릴 때

ScrollRect에 Content로 들어가 있는 오브젝트에 달린 Button이 잘 안눌린다. (버튼이 눌리지 않고 스크롤이 되는 것) EventSystem을 수정해보자. EventSystem eventSystem; eventSystem.pixelDragThreshold = (int)(0.5f * Screen.dpi / 2.54f);