블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2737)
Unity3D (817)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
04-21 00:01

NGUI로 여러 해상도 대응 꽉 채우기

(참조 : http://hanamoni.tistory.com)



 1280x720 해상도 기준


[순서]

1) NGUI-UIRoot.cs 열기.


2) Inspector Window 에서 설정.

    Scaling Style - Constrained On Mobiles

    Content Width - 1280 Fit  (Check)

    Content Height - 720 Fit  (Check)


3) UIRoot-Update() 함수에서 아래를 교체

   [원본]

    mTrans.localScale = new Vector3(size, size, size);


   [변경]

    float fX = (NGUITools.screenSize.x / 1280f);

    float fTemp = (720f * fX);

    float fY = NGUITools.screenSize.y / fTemp;

    mTrans.localScale = new Vector3(size, size * fY, size);





[참조 링크의 내용]


NGUI 새로운 버젼.. 


해상도가 안맞아서 해상도에 맞게 늘릴려고 만든. 코드.


UIRoot 에서


기준을 1280 X 720 할때.


Inspector Window 에서 설정.

Scaling Style - Constrained On Mobiles

Content Width - 1280 Fit  Check 

Content Height - 720 Fit  Check



UIRoot 스크립트 에서  변경.



void Update ()  에서.


mTrans.localScale = new Vector3(size, size, size);  < -  이코드를 




float x_value = (screen.x / 1280f);

float temp_value = (720f * x_value);

float y_value = screen.y / temp_value;


mTrans.localScale = new Vector3(size , size * y_value, size );


요렇게 변경하면


기준 1280 x 720 으로 잡고 모든해상도에 맞게 잘 늘어나거나 줄어든다.

반응형
Posted by blueasa
, |