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

카테고리

분류 전체보기 (2731)
Unity3D (814)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (57)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (51)
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
03-29 07:22

[NGUI 2020.2.2 사용 중..]

 

NGUI에서 UI가 가릴 때 Game 내 일반 오브젝트에 영향을 안주게 막기 위해서

예전에는 UICamea.hoveredObject를 사용했는데, 이번에 사용해보니 값이 이상하다.

그래서 좀 찾아보니 UICamea.IsOverUI가 있다.

참조 링크의 내용에는 문제가 있는 것처럼 말하긴 하는데 빌드해서 봐도 별다른 문제점은 없어보여서 일단 쓰기로 함.

 

[참조] http://www.tasharen.com/forum/index.php?topic=13282.0

 

UICamea.hoveredObject, UICamera.fallThrough, IsOver UI Problem.

When 3D Object and NGUI Object located same position on viewPort, "if(UICamera.hoveredObject != null)" code only touched NGUI Object. This code is no problem NGUI 3.0.2 version, Editor and Mobile too. But, latest version "UICamera.hoveredObject" is pointed

www.tasharen.com

[다른방식] https://blueasa.tistory.com/2549

 

[펌] NGUI와 일반 오브젝트 구분 피킹법

NGUI 를 사용하면서 GUI에 가린 오브젝트들이 GUI와 같이 클릭되는 현상을 게임 제작하면 많이들 보게됩니다. 그럴때는 아래 소스에서 작동하는 녀석으로 쓰면됩니다. if (UICamera.Raycast (Input.mousePosit

blueasa.tistory.com

 

반응형
Posted by blueasa
, |

NGUI 를 사용하면서 GUI에 가린 오브젝트들이 GUI와 같이 클릭되는 현상을 게임 제작하면 많이들 보게됩니다. 그럴때는 아래 소스에서 작동하는 녀석으로 쓰면됩니다.

 

if (UICamera.Raycast (Input.mousePosition) == true) 
{

        // NGUI 오브젝트가 선택되었음
} else

{

       // 해당 일반 오브젝트 선택되었음

}

 

or

 

if(null == UICamera.hoveredObject)

{

    // 게임쪽 클릭 처리

}

 

본인은 2번째 소스로 쓰다가 최근에 들어서 모바일에서 작동이 잘 안하는 관계로 1번을 사용하고 있습니다.



출처: https://sjcy.tistory.com/entry/NGUI와-일반-오브젝트-구분-피킹법 [Charlotte's web]

 

NGUI와 일반 오브젝트 구분 피킹법

NGUI 를 사용하면서 GUI에 가린 오브젝트들이 GUI와 같이 클릭되는 현상을 게임 제작하면 많이들 보게됩니다. 그럴때는 아래 소스에서 작동하는 녀석으로 쓰면됩니다. if (UICamera.Raycast (Input.mousePosit

sjcy.tistory.com

 

반응형
Posted by blueasa
, |

Re: UI Label line count

« Reply #5 on: July 19, 2013, 07:04:08 PM »

Just count instances of '\n' in the UILabel.processedText

 

 

[출처] www.tasharen.com/forum/index.php?topic=4509.0

 

UI Label line count

how can i get the total number of lines which will be required to show the label if it is limited with max line count. i will try and explain this more suppose i have a label which has suppose 40 lines, now to make label look small i set the Max Line var f

www.tasharen.com

 

[참조] devkorea.co.kr/bbs/board.php?bo_table=m03_qna&wr_id=42437

 

데브코리아

한국 게임개발자 커뮤니티

devkorea.co.kr

 
반응형
Posted by blueasa
, |

So I had some spare time to study things I've always wanted to.

Left: Default shader // Right: Blur shader

Note:
All shader files (including the files with number suffix) must be downloaded together.
The numbers represent the clipping panel count when using Soft Clip on UIPanel components.
Refer to: http://www.tasharen.com/forum/index.php?topic=13985.0

 

Unlit - Transparent Colored Blur.shader
0.00MB
Unlit - Transparent Colored Blur 1.shader
0.00MB
Unlit - Transparent Colored Blur 2.shader
0.00MB
Unlit - Transparent Colored Blur 3.shader
0.00MB

 

 

You can customize the amount of blurring by editing the two fields below.
iterations variable represents the radius.
blurSize variable represents the scale (in UV coordinate) which the other pixel should be sampled from.
It should be possible to expose these fields so you can mess around with them through Materials or C# scripts.

half blurSize = 0.005; half iterations = 4;

Limitations:
Originally I wanted to implement a Gaussian Blur effect but it's quite complicated and expensive.
So it ended up in a sort of "hack" by blurring the pixels in horizontal and vertical axis only.
While it may look fine on low iteration count, it doesn't take the diagonal pixels in to calculation, making high radius blurs look unnatural.
I am planning to make another workaround for this issue some time.

 

 

[출처] m.blog.naver.com/reisenmoe/221268044207

 

[Unity, NGUI, Shader] Transparent Colored Blur shader

So I had some spare time to study things I've always wanted to.Note: All shader files (includin...

blog.naver.com

 

반응형
Posted by blueasa
, |

[링크]

https://qits.tistory.com/m/entry/NGUI-%EC%8A%A4%ED%81%AC%EB%A1%A4-%EB%8A%90%EB%A0%A4%EC%A7%80%EB%8A%94-%ED%98%84%EC%83%81-%EC%9E%AC%EC%82%AC%EC%9A%A9%EB%A6%AC%EC%8A%A4%ED%8A%B8%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EC%A7%80-%EC%95%8A%EA%B3%A0-%EA%B8%B0%EB%8A%A5-%EA%B0%9C%EC%84%A0

 

NGUI 스크롤 느려지는 현상 (재사용리스트를 사용하지 않고 기능 개선)

NGUI로 스크롤 을 구현하다보면 Grid를 사용하는 것이 일반적인데, 아이템이 많아지면 느려지는것을 자주 보게 된다. 아이템이 많아지니까 느려지는것은 어찌보면 당연한 일이다. 하지만 그대로 사용할수없으니 해..

qits.tistory.com

 

반응형
Posted by blueasa
, |

[링크] https://redforce01.tistory.com/242

 

[NGUI] Infinite ScrollView (AT)

최근 회사에서 채팅UI의 구조 개선에 대한 이슈가 발생하여 만들어두었던 채팅창을 모두 갈아엎게 되었다. 기존의 채팅 UI구조는 채팅메세지가 들어올 때마다 Instantiate ( ) 가 수행되어 말풍선 UI가 계속해서..

redforce01.tistory.com

 

반응형
Posted by blueasa
, |

[수정] 2021-06-10

Height 값 참조 오류 수정(참조 값 manualHeight -> activeHeight로 변경)

 

[스크립트 파일]

UISafeAreaOffsetController.cs
0.00MB

 

아래 위치와 같이 Anchor의 하위에 GameObject를 하나 만들고,

인스펙터와 같이 Top/Bottom에 따라 만들어진 GameObeject를 Drag&Drop 해서 Link 한다.

 

 

위와 같이 셋팅해 주면 Fan이 Top쪽 Safe Area가 있으면 그에 맞게 좀 더 내려온다

(Bottom은 같은 형태로 List Offset List_Bottom에 Link 해주면 된다.)

 

대충 만들어서 넣어놔서 정리좀 하고 싶지만 다음 기회로..

필요하신 분은 받아서 써보시고 개량해서 공유 좀 해주세요~

 

 

[참조] https://blueasa.tistory.com/2272

반응형
Posted by blueasa
, |

우선, NGUI의 UIAnchor 대해 SafeAreas 대응 할 수 있기 때문에 참고.

이외에도 SafeAreas으로 다음의 대응이 필요하지만,이 기사에서는 UIAnchor의 대처 방법을 설명합니다.

필요할 수 :

· UIRect의 Anchor

· UIScrollView의 표시 범위 조정 (Anchor의 기준이 변화하기 때문에 UI 조정해야 할)




Contents [ hide ]

전제 조건 :

이 문서는 다음을 전제로 이야기를 진행합니다.

· Unity5.6.6를 사용하여 개발하고 있습니다.

· iOSSafeAreasPlugin을 다운로드하여 가져올 수 있음

Plugin 다운로드 사이트

https://bitbucket.org/p12tic/iossafeareasplugin/src

· OS는 iOS만을 고려하고 있습니다.

소스 코드

우선 소스 코드에서 공개합니다.

안전 영역의 취득

SafeAreaScreen.cs

이 소스 코드는 주로 안전 영역의 취득을 담당하고 있습니다.

Unity 편집기에서 화면 크기를 iPhoneX와 같은 크기 (1125 × 2436)로 설정하면 Unity Player에서 디버그 할 수도 있습니다.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;

public class SafeAreaScreen  {

#if UNITY_IOS
    [DllImport("__Internal")]
    private extern static void GetSafeAreaImpl(out float x, out float y, out float w, out float h);
#endif

    static public Rect GetSafeArea()
    {
        float x, y, w, h;

        //初期値設定
        x = 0;
        y = 0;
        w = Screen.width;
        h = Screen.height;

#if UNITY_IOS && !UNITY_EDITOR
        //iOSSafeAreasPluginを呼び出す
        GetSafeAreaImpl(out x, out y, out w, out h);

#elif UNITY_ANDROID && !UNITY_EDITOR
        //Androidの縦長端末対応が必要になったときのために

#else


        //UnityエディタでiPhoneXのテストできるように値を設定する
        if(Screen.width == 1125 && Screen.height == 2436 ){
            y = 102;
            h = 2202;
        }

#endif
        return new Rect(x, y, w, h);
    }

    static public int GetTopOffsetY(){
        int offset = 0;

        //画面の高さとセーフエリアの高さの差分
        Rect screenSize = GetSafeArea();

        if (Screen.height != screenSize.height) {
            offset = Screen.height - (int)screenSize.height - (int)screenSize.y;
        }

        return offset;
    }

    static public int GetBottomOffsetY(){
        int offset = 0;

        //セーフエリアのyの位置取得
        Rect screenSize = GetSafeArea();

        if (Screen.height != screenSize.height) {
            offset = (int)screenSize.y;
        }

        return offset;
    }

}

NGUI의 SafeArea

NguiSafeAreaPatch.cs

SafeAreaScreen.cs에서 얻은 안전 영역을 바탕으로 Anchor의 위치를 ​​조정합니다.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NguiSafeAreaPatch : MonoBehaviour {

    void Awake()
    {
        // UIAnchorを使ってAnchorを設定している場合
        UIAnchor anchor = gameObject.GetComponent();
        if(anchor != null){

            //offsetの値を取得する
            SetUIAnchorOffset(anchor);

            return;
        }

        // UIRectをAnchorを使っている場合
        UIRect rect = gameObject.GetComponent();
        if (rect != null) {
            //現在,NGUIのソースコードを解析中
            //完成しだい公開予定
            return;
        }
    }

    private void SetUIAnchorOffset(UIAnchor anchor){

        //現在のoffsetを取得する
        Vector2 nowOffset = anchor.pixelOffset;

        //TOP側の補正値取得
        int topCorrectionOffset = SafeAreaScreen.GetTopOffsetY ();

        //Bottom側の補正値取得
        int bottomCorrectionOffset = SafeAreaScreen.GetBottomOffsetY ();

        switch (anchor.side) {

            case UIAnchor.Side.Top:
            case UIAnchor.Side.TopLeft:
            case UIAnchor.Side.TopRight:
                anchor.pixelOffset.Set(nowOffset.x, nowOffset.y - topCorrectionOffset);

            break;

            case UIAnchor.Side.Bottom:
            case UIAnchor.Side.BottomLeft:
            case UIAnchor.Side.BottomRight:
                anchor.pixelOffset.Set(nowOffset.x, nowOffset.y + bottomCorrectionOffset);			
            break;


        }
        
    }



}

 

사용법은이 소스 코드를 UIAnchor가 부착되어있는 게임 객체에 첨부 할뿐.

소스에서 무슨 일을하는지는 동작 환경이 iPhoneX 판정되면 스크린과 안전 영역의 높이의 차이를 계산하여 차등 분 게임 오브젝트를 낮 춥니 다.

델타 값은 UIAnchor의 "Pixel Offset"에 할당됩니다.

소스 코드를 반영한 ​​결과

NguiSafeAreaPatch.cs을 UIAnchor에 연결시킨 결과를 기재합니다.

■ 반영 전

■ 반영 후

그 결과 안전 영역을 기준으로 할 수있었습니다.

이것으로 UIAnchor 대해서는 SafeArea의 대처가되었습니다.

그러나, 그 밖에도 「UIRect의 Anchor '에 대해서도 SafeAreas 대응이 있습니다. 대응이 끝나는대로 수시 문서에 추가하는 것입니다.

 

 

[출처] https://dream-target.jp/2018/10/01/post-470/

 

UnityにてiPhoneX対応・NGUIのUIAnchorにSafeAreaの補正処理を入れてみた

とりあえず、NGUIのUIAnchorについてSafeAreas対応ができたのでメモ。 実行環境がiPhoneXと判定したら、スクリーンとセーフエリアの高さの差分を計算して、差分だけゲームオブジェクト(UIAnchorがアタッチされていること)を下げます。

dream-target.jp

 

반응형
Posted by blueasa
, |

[링크]

https://carrotclub.tistory.com/entry/NGUI-%EC%82%AC%EC%9A%A9-%ED%9D%90%EB%A5%B4%EB%8A%94-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%A7%8C%EB%93%A4%EA%B8%B0

 

NGUI 사용 흐르는 문자열 만들기

가. 흐르는 문자열 만들기 - 사용 조건 : NGUI가 있어야 함. 나. 코드 - NGUI UILabel.cs 파일내에 있는 overflow enum 값에 FlowText 라는 값을 추가해준다. 해당 옵션이 되어져 있을 경우 글자가 흐르게 할 예정..

carrotclub.tistory.com

 

반응형
Posted by blueasa
, |


Unlit - Transparent Colored GrayScale.zip




NGUI의 ScrollView 안에 있는 오브젝트의 UITexture에 GrayScale을 적용하려고 아래 [참고]의 쉐이더를 썼는데


제대로 안되길래 보니 Clipping 개수에 따른 추가 쉐이더가 없어서 겸사겸사 만들어서 올려 놓음.



[참고] http://blueasa.tistory.com/1807

반응형
Posted by blueasa
, |