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

카테고리

분류 전체보기 (2738)
Unity3D (817)
Programming (475)
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
05-01 00:59

 

 

 

반응형
Posted by blueasa
, |

[추가] Android / iOS 방식이 달라서 플랫폼에 따라 Two Letter ISO 받는 방식을 다르게 적용

 

    /// <summary>
    /// Two Letter ISO Language
    /// [참조] https://lonewolfonline.net/list-net-culture-country-codes/
    /// [참조] https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
    /// </summary>
    /// <returns></returns>
    public static string GetTwoLetterISOLanguage()
    {
        string strCurrentCultureName = "en";
#if UNITY_EDITOR
        strCurrentCultureName = "en";
#elif UNITY_ANDROID
        strCurrentCultureName = GetTwoLetterISOLanguage_Android();
#elif UNITY_IOS || UNITY_IPHONE
        strCurrentCultureName = GetTwoLetterISOLanguage_iOS();
#endif
        return strCurrentCultureName;
    }

    public static string GetTwoLetterISOLanguage_iOS()
    {
        string strTwoLetterISOLanguageName = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        Debug.LogFormat("[GetCurrentCultureName_iOS] {0}", strTwoLetterISOLanguageName);
        return strTwoLetterISOLanguageName;
    }

    // returns "en" / "de" / "hi" / "th" / "ar" / ...
    public static string GetTwoLetterISOLanguage_Android()
    {
#if !UNITY_EDITOR && UNITY_ANDROID
        try
        {
            var locale = new AndroidJavaClass("java.util.Locale");
            var localeInst = locale.CallStatic<AndroidJavaObject>("getDefault");
            var name = localeInst.Call<string>("getLanguage");
            Debug.LogFormat("[getLanguage] {0}", name);
            return name;
        }
        catch (System.Exception e)
        {
            return "Error";
        }
#else
        return "Not supported";
#endif
    }

    // returns "eng" / "deu" / "hin" / ...
    public static string GetThreeLetterISOLanguage_Android()
    {
#if !UNITY_EDITOR && UNITY_ANDROID
        try
        {
            var locale = new AndroidJavaClass("java.util.Locale");
            var localeInst = locale.CallStatic<AndroidJavaObject>("getDefault");
            var name = localeInst.Call<string>("getISO3Language");
            Debug.LogFormat("[getISO3Language] {0}", name);
            return name;
        }
        catch (System.Exception e)
        {
            return "Error";
        }
#else
        return "Not supported";
#endif
    }

[출처]

answers.unity.com/questions/729801/using-applicationsystemlanguage-returns-unknown.html?_ga=2.105896064.227436567.1600081424-730033693.1580204381

 

Using Application.systemLanguage returns Unknown - Unity Answers

 

answers.unity.com

 

 

[참조]

You should also be able to use .NET to get the current culture instead:

using System;
using System.Globalization;
using System.Threading;

CultureInfo myCulture = Thread.CurrentThread.CurrentCulture;


// You can then use all these member variables
myCulture.DisplayName
myCulture.EnglishName
myCulture.Name (e.g. es-ES / en-GB)
myCulture.Parent (e.g. es / en)
myCulture.ThreeLetterISOLanguageName (e.g. spa/eng/hin)
myCulture.TwoLetterISOLanguageName (e.g. es/en/hi)

 

Here's a selection of the Indian 3 and 2 letter ISO codes (see attached jpg)

 

[출처] forum.unity.com/threads/automatically-set-hindi-language.624973/

 

Automatically set Hindi language

As you all know it's possible to use SystemLanguage to detect the default language of the device running the game. When my game opens, i use it to...

forum.unity.com

 

반응형
Posted by blueasa
, |

exception : Not a valid calendar for the given culture. Parameter name: value

 

---------------------------------------------------------------------------------------

 

iOS에서 시스템 언어가 태국어(Thai) 일 때, 위와 같은 에러가 나서 확인해보니,

il2cpp에서 태국어 일 때 CultureInfo를 제대로 생성 못하는 버그가 있다고 한다.

 

그래서 [참조] 링크의 내용을 참조해서 아래와 같이 소스를 넣고, 앱 시작 시 실행하도록 소스를 추가 했다.

(아랍어도 같은 이슈가 있다고 해서 소스를 같이 추가함)

 

    public static void InitArabicCalendarCrashFix()
    {
        // Two Letter ISO Language
        string strTwoLetterISOLanguage = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        Debug.LogFormat("[CurrentCulture.strTwoLetterISOLanguage] {0}", strTwoLetterISOLanguage);
        if (strTwoLetterISOLanguage == "ar")
        {
            new System.Globalization.UmAlQuraCalendar();
        }

        // CultureName
        //string strCurrentCultureName = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
        //Debug.LogFormat("[CurrentCulture.Name] {0}", strCurrentCultureName);
        //if (strCurrentCultureName == "ar-SA")
        //{
        //    new System.Globalization.UmAlQuraCalendar();
        //}
    }

    public static void InitThaiCalendarCrashFix()
    {
        // Two Letter ISO Language
        string strTwoLetterISOLanguage = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        Debug.LogFormat("[CurrentCulture.strTwoLetterISOLanguage] {0}", strTwoLetterISOLanguage);
        if (strTwoLetterISOLanguage == "th")
        {
            new System.Globalization.ThaiBuddhistCalendar();
        }

        // CultureName
        //string strCurrentCultureName = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
        //Debug.LogFormat("[CurrentCulture.Name] {0}", strCurrentCultureName);
        //if (strCurrentCultureName == "th-TH")
        //{
        //    new System.Globalization.ThaiBuddhistCalendar();
        //}
    }

 

 

 

[참조]

forums.xamarin.com/discussion/42899/datetime-tostring-throws-argumentoutofrangeexception-in-thai-locale

 

DateTime.ToString() throws ArgumentOutOfRangeException in Thai locale

Hi, We're seeing an issue when our app is being used on iOS when in the Thai locale, seemingly down to the DateTime.ToString() method throwing an ArgumentOutOfRangeException with the message "Not a valid calendar for the given culture".

forums.xamarin.com

 

반응형
Posted by blueasa
, |

fontforge를 사용 하면 쉬운 작업입니다 .

먼저 글리프가없는 글꼴을 열고을 선택 Element -> Merge Fonts합니다. 이 예에서 E및에 대한 글리프는 F누락 된 글리프입니다 . 

글리프를 가져올 글꼴을 선택하십시오. 기존 커닝을 유지할 것인지 묻습니다. No여기서 선택하고 싶겠지 만 이상한 결과가 나오면 fontforge를 닫고로 다시 시도하십시오 Yes.

누락 된 글리프는 잠시 후에 추가해야합니다.

마지막으로 File -> Generate Fonts글꼴을 원하는 위치로 내보내십시오.

 

 

[출처] qastack.kr/superuser/490922/merging-two-fonts

 

두 개의 글꼴 병합

 

qastack.kr

 

반응형
Posted by blueasa
, |

Problems that Thai is [?] In [Unity] iOS13

phenomenon

If when you try to multi-lingual in Unity Oke Select the default font asset referred to as "Arial", so you use Yoshinani the system font, but I did not have a problem until now, generating a phenomenon that garbled in iOS13 are you with.

Screenshot is iOS13.2.1 (iPhone8). In the middle of the screen [?] [?] [?] [?] And is in a place that is garbled applicable.
VIEW IMAGE

Investigation

Even Unity of the Issue have been reported, Armenian in addition to Thai, it seems to become garbled in Georgian.

For more details, it might be good to get a look at the people of Issue.

It summarizes the results of actually examined.

  • If you set the Thai fonts will be displayed without any problems.

    Screenshot is iOS13.2.1 (iPhone8). VIEW IMAGE
  • In iOS12.4.1 it will be as normally displays the Thai below.

    Screenshot is iOS12.4.1 (iPhoneXR). VIEW IMAGE
  • In Android10 it will be as normally displays the Thai below.
  • Unity version was also confirmed at 2018.3 and 2019.1, but it was the same result.

The method and the iOS language settings to use the system font to fall back a font to another tried such as the Thai, but it did not change.

temporary solution

Since it has published an app that was the Thai correspondence, it does not need to wait for the renovation of Unity.

Thinking of correspondence has the following procedure.

  1. Put the Thai font, eliminate garbled
  2. Raise Unity and is After the corresponding version

Since there is a free font Fortunately Thai, and the garbled solve with it.

Since a little thinner than the default font, it may not afford the alternative as long as there is a commitment.

I learned for the first time a license that GPL font exception. I did not know what I do a credit notation, it was for the time being added. If you have somebody who is familiar wait for information.

Font size was 480KB. I thought one more font size increases, but I have put in a not too nervous and if this much. But does not recommend because as far as possible towards the size of the app is small, I think good for the user.

Something like the following, we have set the font in the timing of switching to Thai.

text.font = Resources.Load<Font> ("Fonts/THSarabunNew/THSarabunNew");

It was also good as switched fallback, but because the provisional support of easy-to-understand on the code TODOhas been switched by the code this time on the grounds that I wanted to write a.

Summary

Because of what is in the Unity side, but have no idea what is in the iOS side, is a story that has survived for the time being in the provisional support.

We look forward to information If you know the other way.

reference

Unity Issue Tracker - [iOS 13.0] Some languages symbols are replaced with a [?] marks
https://issuetracker.unity3d.com/issues/ios-13-dot-0-all-thai-symbols-are-replaced-with-a-marks

Font - Unity manual
https://docs.unity3d.com/ja/2018.1/Manual/class-Font.html

[Unity] want to use a font that is installed on the OS in the Unity - Terra sur-blog
http://tsubakit1.hateblo.jp/entry/2018/05/30/234314

Public institutions of Thailand to issue "Thai font free" | Thailand favor
https://thaion.net/thai-font-sipa

Fxnt. Khxm »Fxnt Sarbrrn Prabprung Run Him" Sarabun New "
https://www.f0nt.com/release/th-sarabun-new/

GPL font exception - Wikipedia
Https://Ja.Wikipedia.Org/wiki/GPL font exception

 

 

[참조1] issuetracker.unity3d.com/issues/ios-13-dot-0-all-thai-symbols-are-replaced-with-a-marks

 

Unity IssueTracker - [iOS 13.0] Some languages symbols are replaced with a [?] marks

To reproduce: 1. Download attached "Thai Font Issue Example.zip" project and open in Unity 2. Build for iOS 3. Deploy the Xcode proj...

issuetracker.unity3d.com

 

[참조2] qiita.com/canecco/items/50b27ba214926e690ab0

 

【Unity】iOS13でタイ語が[?]になる問題 - Qiita

現象 Unityで多言語に対応しようとすると「Arial」というデフォルトのフォントアセットを選択しておけば、システムフォントをよしなに使ってくれるので今まで問題がなかったのですが、iOS13

qiita.com

 

[출처] titanwolf.org/Network/Articles/Article?AID=0f5127d9-dcac-4e95-8c1b-a97b6bc9a5c7#gsc.tab=0

 

Problems that Thai is [?] In [Unity] iOS13(Others-Community)

 

titanwolf.org

 

반응형
Posted by blueasa
, |

[문제원인]

  • 유니티에서 사용하는 C#에서 DateTime을 사용하여 달력정보를 가져올 경우 태국어에서 문제 발생.
    • 역법의 차이에서 문제가 발생.
    • 대부분의 국가는 그레고리력을 사용중이지만, 태국은 태국역법을 사용하여, 543년의 차이 발생.

         * 표준 불력은 석가모니 입적인 기원전 544년을 기준으로 사용. 태국은 이 표준불력에서 1년의 차이 발생.

  • 서버에서 내려주는 달력정보 스트링을 파싱하는 과정에서 태국어일 경우 문제 발생.
    • 스트링 포맷의 차이를 제대로 인지하지 못하고 파싱 실패. (표기 방법 상이)

 

[해결방안]

  • 클라이언트가 시스템 시간정보를 읽어 올 때, 태국어 예외 처리.

            DateTime lTime = DateTime.Now;
            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == "th-TH" 

            && Application.platform == RuntimePlatform.IPhonePlayer)
            {
                lTime = lTime.AddYears(-543);
            }

           서버에서 사용하는 그레고리력으로 통일

  • 서버에서 내려주는 달력정보의 스트링을 파싱하는 함수 변경. (포맷을 명확히 지정)

           String lCalendar = "";

           DateTime.Parse(lCalendar)  -> DateTime.ParseExact( lCalendar, "yyyy-MM-ddTHH:mm:ss.fffZ", null);

           서버에서 내려주는 포맷을 일치 시킬수 있도록 주의

 

 

반응형
Posted by blueasa
, |

 

Alpha 적용 (전)

 

김프의 Color to Alpha 도구는 사용 방법을 알고 있으면 매우 편리하며이 작업은 특히 적합합니다.

  1. 김프에서 이미지를 열고 필요한 경우 RGB 색상 모드로 변경하십시오.
  2. 레이어 → 투명도 → 색상을 알파로 ...를 선택합니다 .
  3. #000000투명하게하려면 색상으로 검은 색 ( )을 선택하십시오 .
  4. "확인"을 클릭하십시오.
  5. 결과 이미지를 PNG 형식으로 저장하십시오.
    Alpha 적용 (후)

 

[출처] qastack.kr/graphicdesign/6449/add-transparency-to-an-existing-png

 

기존 PNG에 투명도 추가

 

qastack.kr

 

[GIMP 다운로드] www.gimp.org/downloads

 

GIMP - Downloads

The official download page for all things GIMP! Please only use the official binaries provided here unless you really, really know what you’re doing (it’s the only way to be safe). We try to provide binaries in-time with regular releases, but may occa

www.gimp.org

 

반응형
Posted by blueasa
, |

[원했던 기능]

- QRCode 색상 지정

- 사이즈 지정

- png(배경 투명) 저장

 

[Link] www.online-qrcode-generator.com

 

QR Code Generator

Free Online QR Code Generator to make your own QR Codes. Online QR Code Barcode Generator is a free, online, real-time to generate QR Code Barcode. Now you begin to create a QR Code or Barcode! Free Online Barcode Generator to make your own Barcode.

www.online-qrcode-generator.com

 

반응형
Posted by blueasa
, |

Unity 를 이용해 그림판 같은 기능을 구현하는 중에 겹치는 이미지의 테두리가 흰색으로 나타나는 현상이 발생 하였다.

 

 

위 화면은 Canvas 에 검정색 원 Image 여러개가 겹쳐 있고 이를 RenderTexture 를 통해 RawImage 로 출력하고 있는 예제 이다. 사용한 이미지는 아래와 같은 설정이 되어 있다.

 

 

Scene 화면을 통해 RawImage 의 테두리 부분을 확대해 보면 다음과 같이 투명하게 처리가 되고 있는 것이 보였다.

 

 

RenderTexture 로 그려주던 Canvas 를 메인으로 돌려보면 아래와 같이 의도 했던 대로 출력이 된다.

 

 

 

1. 이미지 테두리 부분의 픽셀이 기존 픽셀과 겹쳐지면서 혹은 덮어 쓰면서 해당 픽셀을 투명하게 바꾸고 있다.

2. RenderTexture 로 변환되 RawImage 로 출력하는 과정에서 테두리 부분이 투명해 지는 현상이 일어난다.

 

1. 이미지가 문제가 있다

2. RenderTexture 가 잘못 그려주고 있다

3. RawImage 가 잘못 출력하고 있다.

 

이미지에 육안으로 확인 되지 않는 투명한(?) 부분이 있다고 가정하고 이를 보정하는 것은 어떨까? 로 시작해 쉐이더를 추가한 Material 을 추가해 보았다.

그 결과 이미지에 Sprites/Default 쉐이더를 사용하는 Material 을 사용하니 간섭 현상이 사라졌다. Material 이 추가되지 않은 이미지의 기본 쉐이더는 UI/Default 쉐이더인데 Sprites/Default 쉐이더와의 차이가 이런 현상을 만드는 것 같다.

 

UI/Default 쉐이더 코드와 Sprite/Default 쉐이더 코드를 비교하며 테스트 했더니 다음과 같이 수정해 문제 해결이 가능했다.

- UI/Default 쉐이더의  Blend SrcAlpha OneMinusSrcAlpha 값을 Blend One OneMinusSrcAlpha 값으로 변경

Blend - 투명 오브젝트를 만드는데 사용합니다.

SrcAlpha - 스테이지 값을 소스 알파 값으로 곱합니다.

One - 1값입니다. 소스 또는 대상 컬러가 완전히 표시되도록 하려면 이 값을 사용합니다.

OneMinusSrcAlpha - 스테이지 값을 (1 - 소스 알파)로 곱합니다.

 

https://docs.unity3d.com/kr/current/Manual/SL-Blend.html

 

ShaderLab: 블렌딩 - Unity 매뉴얼

블렌딩은 투명 오브젝트를 만드는 데 사용됩니다.

docs.unity3d.com

 

정리하자면 소스 알파 값이란 새로 그려진 이미지의 알파 값이고 스테이지 값은 기존 화면에 그려져 있는 값인데 이둘을 곱하면 새로 그려진 이미지의 알파값을 따라가기 때문에 이를 1값으로 변경해 새로 그려진 이미지의 알파 값을 따라가지 않게 수정 함으로써 해결 됬다고 생각한다.

 

위와 같은 문제 때문이 었다면 RenderTexture 를 통하지 않고 직접 그리는 이미지에서도 해당 상황이 재현되야 하지 않을까? 하지만 직접 그리는 이미지에서는 해당 이슈가 발생하지 않는다. 

 

RenderTexture 설정이 잘못되어 출력이 잘못 되고 있는 것은 아닐까?

RenderTexture 의 Color Format 설정을 바꿔보니 다음 두 경우에 원했던 형태의 출력이 되는 것을 확인 하였다.

RGB565 - 모든 그래픽 카드를 지원하지 않는 16 bit 텍스쳐 포멧

RGB111110Float - 모든 그래픽 카드를 지원하지 않는 포멧

https://docs.unity3d.com/ScriptReference/RenderTextureFormat.html

 

Unity - Scripting API: RenderTextureFormat

You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see: You've told us there are code samples on this page which don't work. If you know ho

docs.unity3d.com

보통의 경우 Default 값인 ARGB32 를 사용할 텐데 ... 이 방법은 아닌 것 같다.

 

RawImage 에서 출력 할 때 문제가 생기는 것은 아닐까?

https://forum.unity.com/threads/using-render-textures-on-a-ugui-image-panel-or-button.272332/

 

Using Render Textures on a uGUI Image, Panel or Button?

Hello! I'm trying to put my minimap into the uGUI system. Is it possible to get a Render Texture working with these? I've got my render texture...

forum.unity.com

관련 이슈로 토론한 흔적이 보인다. 여기서 찾은 방법은 UI/Default 쉐이더에서 알파 클립을 제거한 커스텀 쉐이더를 RawImage 에 붙여 해결한 것이다. 쉐이더 코드를 보면 강제로 알파 값을 1로 만들어 주는 역활을 하고 있다.

UI-Default-No-Alpha.shader
0.00MB

 

여지껏 시도해 봤던 방법 중에 커스텀 쉐이더를 RawImage 에 적용하는 방법이 제일 괜찮아 보여 일단은 이것으로 해결. 왜 저러는 건지에 대해서는 좀더 찾아봐야 될듯...



출처: https://ukprog.tistory.com/56 [Vader87]

 

[Unity3D] RenderTexture RawImage 출력 이슈

Unity 를 이용해 그림판 같은 기능을 구현하는 중에 겹치는 이미지의 테두리가 흰색으로 나타나는 현상이 발생 하였다. 위 화면은 Canvas 에 검정색 원 Image 여러개가 겹쳐 있고 이를 RenderTexture 를 ��

ukprog.tistory.com

 

반응형
Posted by blueasa
, |