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

카테고리

분류 전체보기 (2739)
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 (54)
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-09 00:01

Untiy 2021.3.14f1

GoogleMobileAds 7.3.0

----

 

Unity 2021로 엔진 업데이트를 하고 빌드해보려는데 에러가 나서 보니 GoogleMobileAds 7.3.0 관련 이슈인 것 같다.

(GoogleMobileAds 7.2.0은 빌드 잘됨)

검색해보니 아래와 같은 해결책이 나온다.

 

- 간단히 말하면 Unity 2021에서 GoogleMobileAds 7.3.0을 쓰려면 gradle 버전 업데이트 하라고 한다. (아래 내용 따라하라고 함)

- 그래서 난 일단 GoogleMobileAds 7.2.0으로 버전을 내렸다(?)

 

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

·8 mo. ago·edited 8 mo. ago

Yo so I found a way to solve this, assuming you are using applovin or charboost , what I did was:

  • Delete resolved libraries : Assets> External Dependancy Manager > Android resolver > Delete resolve libs
  • in player settings > pulishing settings uncheck all the one under build
  • Download gradle 6.9
  • Prefrences > external tools > uncheck gradle and browse to the installed gradle
  • Assets> External Dependancy Manager > Android resolver > Force resolve
  • then player settings > pulishing settings check all the ones you uncheck plus Custom Base Gradle Template
  • edit the file Asstes\Plugins\Android\baseProjectTemplate.gradle
  • change target api level to 31
  • change the line that looks like classpath 'com.android.tools.build:gradle:yourversion' to classpath 'com.android.tools.build:gradle:4.2.0'

Build now it works. the funny thing is that gradle is 6.9 and com.adroid.tools.build:gradle: is 4.2.0 but it works.

[출처] https://www.reddit.com/r/Unity3D/comments/tktc13/i_need_help_asap/

 

I NEED HELP ASAP

**Hello everyone. I've been trying to build my game but I get these errors:** *...

www.reddit.com

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

Hello. I solved my problem this way.
Download the latest Gradle version here.
https://gradle.org/releases/

Place the unzipped Gradle file in the following location
/Applications/Unity/Hub/Editor/2021.3.12f1/PlaybackEngines/AndroidPlayer/Tools/gradle/
Please note that 2021.3.12f1 is the editor version and should be replaced with your own environment.

Next, open Unity and change the Gradle to be used.
From the top menu, select Unity > Preferences and open External Tools.

Uncheck the box marked "Gradle Installed with Unity (recommended)" and enter the path to the Gradle you just placed.

Now the Gradle used for building has been switched to a different version.
If there are no problems with the version, you should now be able to build Android.

 

[출처] https://github.com/googleads/googleads-mobile-unity/issues/2390

 

This feature requires ASM7 · Issue #2390 · googleads/googleads-mobile-unity

[REQUIRED] Step 1: Describe your environment Unity version: 2021.3.12f1 Google Mobile Ads Unity plugin version: 7.3.0 Platform: Unity Editor Platform OS version: Android 12 Any specific devices iss...

github.com

 

반응형
Posted by blueasa
, |

Unity2020.3.40f1

Xcode 14.1

 

Xcode 14로 업데이트 후, iOS 빌드 하면 제목과 같은 에러가 발생한다.

 

- 관련 에러 위치 찾아가서 Team Id를 선택하면 잘되긴 하는데, 빌드때마다 수동으로 하기는 애매해서 찾아보니 PodFile에 아래 내용을 추가하면 된다고 한다.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
        config.build_settings['CODE_SIGN_IDENTITY'] = ""
        #prevent resource bundle from reading image nil
        config.build_settings.delete('PRODUCT_BUNDLE_IDENTIFIER')
      end
    end
  end
end

[출처] https://github.com/CocoaPods/CocoaPods/issues/11402 : JosephPoplar 댓글

 

Xcode 14 build failed with manual code sign and app resource bundles · Issue #11402 · CocoaPods/CocoaPods

I've read and understood the CONTRIBUTING guidelines and have done my best effort to follow. Report What did you do? Integrate a pod with resource bundle. Set app code sign style to Manual. Bui...

github.com

 

 

- iOS 빌드해서 PodFile 수작업을 계속할 수는 없는지라  Unity의 Xcode PostProcessBuild에서 자동으로 추가하도록 함.

(Define을 봐서는 Unity2019.3 이상에서만 가능한 것 같다)

#if UNITY_2019_3_OR_NEWER
        // FixPodFile 사용법 참조
        // https://github.com/googlesamples/unity-jar-resolver/issues/405 : Str4tos 댓글
        [PostProcessBuild(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50)
        private static void FixPodFile(BuildTarget buildTarget, string buildPath)
        {
            /// Stop processing if target is NOT iOS
            if (buildTarget != BuildTarget.iOS)
                return;

            using (StreamWriter sw = File.AppendText(buildPath + "/Podfile"))
            {
                // [Error 대응] (Xcode 14): Signing for "GoogleSignIn-GoogleSignIn" requires a development team.
                // [해결방법 참조] https://github.com/CocoaPods/CocoaPods/issues/11402 : JosephPoplar 댓글
                sw.WriteLine("\npost_install do |installer|\n  installer.pods_project.targets.each do |target|\n    if target.respond_to?(:product_type) and target.product_type == \"com.apple.product-type.bundle\"\n      target.build_configurations.each do |config|\n        config.build_settings['CODE_SIGN_IDENTITY'] = \"\"\n        #prevent resource bundle from reading image nil\n        config.build_settings.delete('PRODUCT_BUNDLE_IDENTIFIER')\n      end\n    end\n  end\nend");

                /// ex
                //sw.WriteLine("\ntarget 'Unity-iPhone' do\nend");
            }
        }
#endif

[출처] https://github.com/googlesamples/unity-jar-resolver/issues/405 : Str4tos 댓글

 

iOS Unity 2019.4 and UnityFramework pod target error · Issue #405 · googlesamples/unity-jar-resolver

[REQUIRED] Please fill in the following fields: Unity editor version: 2019.4.11f1, 2020.1.7f1 External Dependency Manager version: v1.2.159 Source you installed EDM4U: Unity Package Manager Feature...

github.com

 

반응형
Posted by blueasa
, |

PostProcessBuild에 아래처럼 FixPodFile()을 추가하고,

원하는 내용을 줄바꿈(\n) 포함해서 WriteLine에 string 형태로 추가한다.

 

#if UNITY_2019_3_OR_NEWER
  [PostProcessBuild( 45 )]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50)
  private static void FixPodFile( BuildTarget target, string buildPath )
  {
      using (StreamWriter sw = File.AppendText( buildPath + "/Podfile" ))
      {
          sw.WriteLine( "\ntarget 'Unity-iPhone' do\nend" );
      }
  }
#endif

 

[출처] https://github.com/googlesamples/unity-jar-resolver/issues/405

 

iOS Unity 2019.4 and UnityFramework pod target error · Issue #405 · googlesamples/unity-jar-resolver

[REQUIRED] Please fill in the following fields: Unity editor version: 2019.4.11f1, 2020.1.7f1 External Dependency Manager version: v1.2.159 Source you installed EDM4U: Unity Package Manager Feature...

github.com

 

[참조] https://github.com/AdColony/AdColony-Unity-Plugin/blob/master/Plugin/Assets/AdColony/Editor/ADCPostBuildProcessor.cs

 

GitHub - AdColony/AdColony-Unity-Plugin: AdColony SDK Open Source Unity Plugin

AdColony SDK Open Source Unity Plugin . Contribute to AdColony/AdColony-Unity-Plugin development by creating an account on GitHub.

github.com

 

반응형
Posted by blueasa
, |

ITMS-90427을 처리하기 위해 확인해보니

Unity-iPhone의 Always Embed Swift Standard Libraries를 YES로 하고,

UnityFramework의 Always Embed Swift Standard Libraries를 NO로 하라고 한다.

 

빌드때마다 수동으로 하기는 그래서 Xcode PostProcessBuild로 처리하기로 함.

 

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
 
namespace Editor
{
    public static class XcodeSwiftVersionPostProcess
    {
        [PostProcessBuild(999)]
        public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
        {
            if (buildTarget == BuildTarget.iOS)
            {
                ModifyFrameworks(path);
            }
        }
 
        private static void ModifyFrameworks(string path)
        {
            string projPath = PBXProject.GetPBXProjectPath(path);
           
            var project = new PBXProject();
            project.ReadFromFile(projPath);
 
            string mainTargetGuid = project.GetUnityMainTargetGuid();
           
            foreach (var targetGuid in new[] { mainTargetGuid, project.GetUnityFrameworkTargetGuid() })
            {
                project.SetBuildProperty(targetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "NO");
            }
           
            project.SetBuildProperty(mainTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
 
            project.WriteToFile(projPath);
        }
    }
}

 

 

[출처] https://forum.unity.com/threads/2019-3-validation-on-upload-to-store-gives-unityframework-framework-contains-disallowed-file.751112/  - unity_Iu70XvRN7XIS4g의 댓글

 

2019.3 - validation on upload to store gives "UnityFramework.framework contains disallowed file"

App runs on phone normally. When trying to validate the app before uploading it to the store, this comes out: Invalid Bundle. The bundle at...

forum.unity.com

 

반응형
Posted by blueasa
, |

Android 7(API 24) 이상에서 지원하는 멀티 윈도우를 막으려면 AndroidManifest.xml에 android:resizeableActivity="false"만 추가하면 됐는데,

위 방식은 API 30까지만 가능하고 API 31(Android 12)부터는 화면이 크면 경고는 뜨지만 막히지 않는다.

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

 

[펌] How can I disable multiwindow mode for an Activity in Android N+

In your manifest, you need: android:resizeableActivity="false" So in your manifest file, for each activity that you want to disable the feature in, it would be like: Or, if you want to disable it in your entire app: . . . As for what will happen, Android j

blueasa.tistory.com

[참조2] https://developer.android.com/guide/topics/large-screens/multi-window-support

 

멀티 윈도우 지원  |  Android 개발자  |  Android Developers

멀티 윈도우 지원 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 멀티 윈도우 모드를 통해 여러 앱이 같은 화면을 동시에 공유할 수 있습니다. 시스템에서

developer.android.com

 

그래서 약간 꼼수로 아래와 같이 처리했다.

 

[차단]

멀티윈도우/팝업윈도우로 갈 때 OnApplicationPause가 작동하기 때문에, OnApplicationPause에서 false 일 때(Pause가 풀릴 때) , Screen의 현재 해상도를 체크해서 내가 사용하는 게임 비율이 아니면 차단하게 함.

    Ex) 가로모드 게임이면, height가 width보다 크면 차단

 

[해제]

멀티윈도우/팝업윈도우에서 정상적인 전체화면 게임으로 돌아와도 OnApplicationPause가 Call 되지 않기 때문에 여기서 처리는 불가능한 걸 확인했다.

그래서 [차단] 할 때, InvokeRepeating을 사용해서 주기적으로 체크(Update를 쓰면 평소에도 Call 되기 때문에 Invoke 사용함)해서 해상도가 내가 사용하는 비율이 맞으면 해제하도록 해놓음.

  Ex) 가로모드 게임이면, width가 height보다 크먼 해제

 

대충 아래와같이 구현해 둠..

void OnApplicationPause(bool _bPaused)
{
    Debug.LogFormat("[OnApplicationPause] {0}", _bPaused);
    // Android에서만 처리하기 위해 Define으로 분기
#if !UNITY_EDITOR && UNITY_ANDROID
    OnApplicationPause_Android(_bPaused);
#elif !UNITY_EDITOR && UNITY_IOS
#endif
}

void OnApplicationPause_Android(bool _bPaused)
{
    // Pause 할 때는 Pass
    if (true == _bPaused)
        return;

    // [Android12(API31) 멀티윈도우 차단
    // Pause 해제 시, 해상도 세로가 가로보다 더 길면 차단(가로모드 게임)
    if (Screen.currentResolution.width <= Screen.currentResolution.height)
    {
        // [Active] UnSupported Resolution Popup
        // (화면을 완전히 가리고, 터치가 안되도록 Collider를 넣음)
        ActivateUnsupportedResolutionPopup(true);

        // 차단 해제 체크용(Update는 항상 돌기 때문에 Invoke로 필요할때만 처리)
        InvokeRepeating("UpdateCheckUnSupportedResolution", 0.1f, 0.1f);
    }
}

void UpdateCheckUnSupportedResolution()
{
    // 해상도가 가로모드 해상도에 맞게 돌아오면 차단 팝업 해제 및 CancelInvoke
    if (Screen.currentResolution.height < Screen.currentResolution.width)
    {
        // [InActive] UnSupported Resolution Popup
        SGT.UIMain.ActivateUnSupportedResolutionPopup(false);

        CancelInvoke("UpdateCheckUnSupportedResolution");
    }
}
반응형
Posted by blueasa
, |

[에러메시지]

NullReferenceException: Object reference not set to an instance of an object.

  at System.Linq.Expressions.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0 

  at System.Linq.Expressions.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0 

  at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate () [0x00000] in <00000000000000000000000000000000>:0 

  at System.Linq.Expressions.Expression`1[TDelegate].Compile (System.Boolean preferInterpretation) [0x00000] in <00000000000000000000000000000000>:0 

  at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0 

  at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0 

  at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0 

  at System.Runtime.CompilerServices.CallSite`1[T].Create (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0 

 

대충 위와같은 에러가 나는데..

유니티에서 dynamic을 쓰면 나는 에러인데..

결론은 유니티는 dynamic을 지원하지 않는다. 쓰지말자.

 

에디터에서는 잘되길래 될 줄 알았더만, 안드로이드 빌드해보니 위와같은 에러가 난다.

해결책이 별시리 없는듯하다.

 

[참조] https://gall.dcinside.com/mgallery/board/view/?id=game_dev&no=53076 

 

유니티 dynamic 못씀? - 인디 게임 개발 마이너 갤러리

분명 유니티 내에서 빌드 안하고 돌리면 잘만 돌아가는데, 빌드된 거 실행해보면 코드에서 에러가 계속 발생함NullReferenceException: Object reference not set to an instanc

gall.dcinside.com

[참조] https://issuetracker.unity3d.com/issues/il2cpp-notsupportedexceptions-exception-is-thrown-in-build-with-newtonsoft-dot-json-plugin

 

Unity IssueTracker - [IL2CPP] NotSupportedExceptions exception is thrown in build with Newtonsoft.Json plugin

Steps to reproduce: 1. Download attached project 2. Build standalone project on IL2CPP backend 3. Launch build project 4. Notice exc...

issuetracker.unity3d.com

 

반응형
Posted by blueasa
, |

[링크] https://dark0946.tistory.com/226

 

[ Unity ] 유니티 로컬라이징, 태국어 폰트 적용 문제

태국어라곤 사와디캅( 정작 태국어로 어떻게 적는지도 모름 ) 밖에 모르던 저에게 태국어 로컬라이징 작업이 떨어졌습니다. 이전부터 게임 한글패치 작업을 좀 해본 경험이 있어서 관련 툴 사

dark0946.tistory.com

[참고] https://github.com/SaladLab/Unity3D.ThaiFontAdjuster

 

GitHub - SaladLab/Unity3D.ThaiFontAdjuster: Utility to render Thai text correctly in Unity3D, especially for positioning tone ma

Utility to render Thai text correctly in Unity3D, especially for positioning tone mark (ก์กิ์ป์ปิ์ฎุญุ). - GitHub - SaladLab/Unity3D.ThaiFontAdjuster: Utility to render Thai text correctly in Unity...

github.com

 

반응형
Posted by blueasa
, |

こんにちは。技術部平山です。

今回は小ネタで、サンプルもありません。ビルドの解像度設定についてです。

スクリーンショットにあるように、PlayerSettingsのResolution and Presentation の項に、Resolution Scalingというものがあり、 Resolution Scaling ModeをデフォルトのDisabledからFixed DPIに 設定することができます( Androidマニュアル iOSマニュアル )。

これは、画素(ピクセル)の密度が同じになるように、機種によって解像度を自動で変える、という設定です。 上の画像では326dpi(dot per inch。1インチあたりの画素数)になっており、 これはiPhone4あたりからの伝統的な値です。 iPhone6Plusのような上位機種を除けば、だいたいこの密度になっています。

実際どうなるのか?

この設定にしておくと、ディスプレイの画素密度が326dpiの機械では、 元の解像度で描画されます。例えばiPhone8なら1334x750です。

ところが、画面の大きさの割に解像度が高い端末、 例えばiPhone8Plusであれば、元よりも低い解像度になります。 元の解像度は1920x1080ですが、これが1560x878になります。 元の画素密度は406dpiもありこれを326dpiに落とすと、 解像度が縦横それぞれ(326/406)倍されるわけです。

何のために使うの?

「無駄に高い解像度で描画して、フレームレートや電力消費を悪化させるのを防ぐため」です。

高解像度で描画する方が綺麗なのは確かですが、タダではありません。 GPUの処理負荷はかなりの部分が画素数に比例しますから、 1920x1080で描画する負荷は、1560x878で描画する負荷に比べて、 およそ1.5倍になります。 CPU側に余裕があって、フレームレートが画素数で決まっているようなケースでは、 この設定を有効にすることでフレームレートが1.5倍になる可能性がある、ということです。

また、元々60fpsで動いているような場合は、電力消費が改善します。 微々たる差しか感じられないことに無駄に電気を食うよりは、 少し解像度を下げて余力を残した方が良いかもしれません。 スマホの場合、あまり電力消費が大きいと熱のために処理能力が低下し、 フレームレートが落ちてくることもよくあります。 前もって解像度を下げておくことは、これを防ぐ効果もあるのです。

実際の例

実際の例としては、iPhone6Plus(1920x1080)で40FPSしか出なかったアプリが、 この設定を有効にするだけで60FPSに改善した例があります。

また、一部Android機のように、 GPU性能の割に解像度が高い(例えば京セラS2で1280x720、S4で1920x1080) 端末では、 元々フル解像度でゲームを動かすことには無理があり、 解像度を下げることで大きくフレームレートが改善します。 S2の場合、対角5インチのサイズで1280x720で、 1280画素ある長辺の長さは4.345インチです。 1280をこれで割ると、294dpiとなります。

iPhoneの326dpiよりも低いですが、 「そもそもこのゲームって、そんなに解像度高くてうれしいの?」 ということをよく考えてみれば、 製品によっては「もう少し低くてもいいな」という判断にもなるでしょう。

お客さんが選べるように選択肢を用意するのも一つの考えかと思いますが、 ほとんどのお客さんにとって適切な設定をデフォルトにするのもまた重要なことです。 画質とフレームレート、電力消費のバランスを鑑みて、 画素密度(dpi)で設定するのは悪くない選択でしょう。 設定一つで済むので実装コストはほぼゼロです。

製品の性質にもよりますが、200から300くらいを設定するのが良いのかな、 と個人的には思います。Nintendo Switchが235dpiであり(Switch Liteは268dpi) それだけあれば十分な気もします。 もし不安があるのであれば、たくさん売れたiPhoneを基準にして上の例のように326 に設定するのも良いでしょう。それでもPlus系での処理落ちを防げます。 その場合も、Androidでは低スペック機に配慮して下げる方が良い気がします (dpi設定はiOSとAndroidを別に持てないので、ビルド前にスクリプトで変更するのが良いでしょう)。

ダイナミックなフォントは解像度が高いほど綺麗になり、 3Dのポリゴンも解像度が高いほど輪郭が綺麗になりますが、 前もって用意したテクスチャは元解像度以上にはなりません。 解像度が高すぎてもボケて見えるだけで、 それは解像度を落として描くのとほとんど変わらないのです。 しかしフレームレートと電力消費は確実に悪化します。

別の方法

お客さんに解像度設定を委ねる場合には、これを使っての設定はできません。 一律になってしまうからです。 設定を見て、 Screen.SetResolution を起動後に呼ぶことになります。

Screenクラスからはdpiも取れますので、FixedDPIを使うのと同じこともできますが、 解像度変更はその場では終わらず次のフレームまでかかりますし、 解像度に依存した処理があると、解像度が変わった時におかしくなる危険もありますから、 注意しましょう。起動直後のみの反映が安全ですが、すぐに確認できないので利便性は落ちます。 設定画面を作るコストの問題もありますから、 製品の性質やお客さんにとっての価値を考えた上で、 良い選択をしてください。

なお、お客さんに設定して頂けるのであれば、 かなり攻めた設定(768x432まで解像度を下げるなど)ができ、 電気が気になる方(例えば私)や、低性能の機種をお使いの方(例えば私)に とってはうれしいのではないかと思います。 過去参加した製品 では、768x432で20fpsという省エネ設定ができるようにしましたが、 完全に私のためでした。

代表的な機械の画素密度

以下に代表的な機械のDPIを表にしておきます。 「この機械はドット粗いなあ」と思う機械よりは上げたいですが、 「これ以上細かくても差がわからないよ」「そもそもそんな高解像度で素材作ってないよ」 という場合には下げて良いかと思います。 素材の解像度が上がれば容量も増えて、通信料金やスマホのストレージにも 悪影響を与えますから、何事も程々のバランスが良いでしょう。

機種対角インチ解像度DPI

iPhone 5S,SE 4 1136x640 326
iPhone 6, 6S, 7, 8 4.7 1334x750 326
iPhone 6Plus, 6S Plus, 7Plus, 8Plus 5.5 1920x1080 406
iPhoneX, XS, 11Pro 5.85 2436x1125 458
iPhoneXS Max, 11ProMax 6.46 2688x1242 458
iPhoneXR, 11 6.06 1792x828 326
古めのiPadの多く 9.7 2048x1536 264
今のiPad 10.5 2224x1668 264
対角5インチの16:9機 5 960x540 221
対角5インチの16:9機 5 1280x720 295
対角5インチの16:9機 5 1920x1080 442
対角24インチのFullHDモニタ 24 1920x1080 92
Retina MacBookPro 13インチ 13 2560x1600 232
Nintendo Switch 6.2 1280x720 238
Nintendo Switch Lite 5.5 1280x720 268

QualitySettingsでの補正

この項目は試していないのですが、たまたま調べたら出てきたので紹介しておきます。

dpi値はQualitySettingsで修正することができるようです。 公式マニュアル にあるように、Resolution Scaling Fixed DPI Factorを設定すれば、 lowやmediumのような設定ごとに、先程設定したdpi値を補正することができるとあります。 0.5を書けば半分になり、例えば326dpiであれば163dpiになって、 解像度が半分になるのでしょう。

機械の性能を見てQualitySettings.SetQualityLevel などを呼んでいる場合には、動的に解像度も変わるのでしょうか? 正常に動くのか、どれくらい処理が止まるのか、といったことはわかりません。

終わりに

今回は小ネタでしたが、下手に最適化で苦労するよりもよほど簡単に効果が上がるので、強くオススメしておきます。

個人的には、多くのゲームのように画面に動きがあるアプリケーションで 300dpiを超えた描画するのは、電池が惜しいと感じます。 もし余力があるのであれば、解像度を上げるよりも、 ライティングなどのピクセルあたりの処理を豪華にする方が、 おそらくは品質も上がるでしょう。

 

 

[출처] https://techblog.kayac.com/unity-fixed-dpi

 

Unityで画素密度を固定する解像度設定(FixedDPI) - KAYAC engineers' blog

こんにちは。技術部平山です。 今回は小ネタで、サンプルもありません。ビルドの解像度設定についてです。 スクリーンショットにあるように、PlayerSettingsのResolution and Presentation の項に、Re

techblog.kayac.com

 

반응형
Posted by blueasa
, |

[링크] https://lunchballer.com/archives/1326

 

[Unity-C#] 특정 국가에서 크래시가 난다면 CultureInfo를 확인하자

Unity 2019부터 .NET 3.5는 더 이상 지원되지 않고, .NET Standard 2.0과 .NET 4.X가 지원된다. .NET Standard 2.0/.NET 4.X은 Unity 2017까지 사용하던 .NET 2.0/.NET 2.0 Subset과 같지 않다. 그래서 글로벌 게임을 서비스 중

lunchballer.com

 

[참조] https://mentum.tistory.com/615

 

Float.Parse not in a correct format 문화권 문제

숫자 변환에서 오류가 발생하다 게임 개발을 하다 보면 string에서 float로 파싱 하여 사용해야 하는 경우가 꽤나 자주 발생한다. 예를 들어, 연출 데이터에서 0.5초 동안 정지한다거나 하는 경우 다

mentum.tistory.com

 

[체크해야 될 함수] 더 있을수도..

float.Parse / float.TryParse / float.ToString

double.Parse / double.TryParse / double.ToString

int.Parse / int.TryParse / int.ToString

long.Parse / long.TryParse / long.ToString

BigInteger.Parse / BigInteger.TryParse  / BigInteger.ToString

DateTime.Parse / DateTime.ParseExact / DateTime.TryParse / DateTime.TryParseExact / DateTime.ToString

TypeConverter.ConvertFrom / TypeConverter.ConvertTo

Convert.To??? 시리즈(Convert.ToInt16/ToInt32/ToInt64/ToUInt16/ToUInt32/ToUInt64,ToDecimal,ToDouble,ToSByte,ToSingle 등)

.ToLower / .ToUpper

string.Format

 

 

[첨언]

Unity 2018에서 Unity 2021로 포팅을 하고 업데이트를 했는데 이상한 에러가 크래시레포트에 많이 수집돼서 확인해보니

위의 링크에 보이는 문제로 보인다.

Unity 2019 부터 바뀐부분이 있어서(참조 링크 보면 됨) int float double BigInteger 등을 Parse 할 때 System.Globalization.CultureInfo.InvariantCulture을 무조건 넣어줘야 될 것 같다.

(CurrnetCulture는 건들면 문제가 생길 것 같아서 그냥 노가다로 다 넣었다.)

 

P.s. 문화권 문제라 한국에서는 아무리 테스트를 해도 크래시가 안나니 무슨 버그인지 몰라서 한참 헤멤..

 

[추가]

CultureInfo 관련 이슈가 있는 함수가 더 있어서 추가해 둠.

아래 함수 2개를 문화권 영향받지 않도록 변경했다.

이 두 함수는 함수 자체가 문화권 영향받지 않는 함수가 있어서 편한 것 같다.

 

TypeConverter.ConvertFrom() → TypeConverter.ConvertFromInvariantString()

TypeConverter.ConvertTo() → TypeConverter.ConvertToInvariantString()

 

[참고] https://learn.microsoft.com/ko-kr/dotnet/api/system.componentmodel.int32converter?view=net-7.0 

 

Int32Converter 클래스 (System.ComponentModel)

32비트 부호 있는 정수 개체와 다른 표현 사이를 변환하는 형식 변환기를 제공합니다.

learn.microsoft.com

 

[나라별 숫자표기 참고] https://theqoo.net/square/298509638

 

나라별로 다른 소수점과 천의 자리 구분 기호 - 스퀘어 카테고리

형태국가1,234,567.89호주, 캐나다 (영어권, 비공식), 중국, 홍콩, 아일랜드, 이스라엘, 일본, 한국, 말레이시아, 멕시코, 뉴질랜드, 파키스탄, 필리핀, 싱가포르, 대만, 태국, 영국, 미국1234567.89국제단

theqoo.net

[숫자표기 참고2] https://docs.oracle.com/cd/E19683-01/816-3980/overview-48/index.html

 

숫자 (국제 언어 환경 설명서)

숫자 영국과 미국은 소수 자릿수를 마침표를 사용해 표시하는 몇 안 되는 국가들 중 두 국가입니다. 그 밖의 많은 국가들은 마침표 대신 콤마를 사용합니다. 소수 구분 기호는 기수 문자라고도

docs.oracle.com

 

[Date format by country] https://gist.github.com/mlconnor/1887156

 

Listing of countries with their preferred date formats, ISO3166 code, ISO629-2

Listing of countries with their preferred date formats, ISO3166 code, ISO629-2 - country_date_formats.csv

gist.github.com

 

 

반응형
Posted by blueasa
, |

[추가] 2024-03-06

2024년 기준 폰 스펙이 많이 올라와서 이젠 최신폰에서 326으로는 깨지는게 보인다.

그래서 아이폰 최신인 아이폰15(460ppi)에 맞추기로 했다.

→ Target DPI : 326 -> 460으로 변경

----

 

1. Player Settings - Resolution and Presentation - Resolution Scaling

    1.1. Disabled → Fixed DPI로 변경

    1.2.1 Target DPI(Default:30) 280으로 변경(iPhone 13에서도 깨지는지 모르겠다고 함)

    1.2.2 Target DPI 326으로 변경(iPhone XR/11 : 326) : 나는 아이폰 기준 맞추기 위해 326으로 변경함

        [참조] https://techblog.kayac.com/unity-fixed-dpi

Fixed DPI : 280

 

2. Android 6.0(API Level 23) 이상이면 Android Texture Format : ASTC 사용 권장

    2.1. iPhone은 이전부터 ASTC 사용 권장하기 때문에 Android 6.0 이상이면 양쪽 플랫폼 동일하게 ASTC 사용가능 할 듯

 

 

[출처] 게임코디-선후님

 

 

반응형
Posted by blueasa
, |