블로그 이미지
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-27 00:02

Unity 2021.3.11f1

I2 Localization(app_name 로컬라이징 용도)

 

I2 Localization 에셋으로 app_name Localization을 하고 있었는데,

Unity 2021.3.11f1으로 업데이트 한 후에 Android에서 로컬라이징이 되지 않고 기본 설정된 App Name만 나오는 문제가 생겼다.

(대충 검색해보니 Unity 2021.3부터 나오는 이슈 같다)

 

그래서 생성된 res 폴더를 ../Assets/Plugins/Android/ 하위에 직접 넣고 빌드해보니 아래와 같은 에러가 나온다.

 

Exception: OBSOLETE - Providing Android resources in Assets/Plugins/Android/res was removed, please move your resources to an AAR or an Android Library. See "AAR plug-ins and Android Libraries" section of the Manual for more details.
UnityEditor.Android.PostProcessor.Tasks.CheckUserResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5e58a3838afa4e88a08dc92f05003dcc>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5e58a3838afa4e88a08dc92f05003dcc>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <5e58a3838afa4e88a08dc92f05003dcc>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <5e58a3838afa4e88a08dc92f05003dcc>:0)
UnityEditor.PostprocessBuildPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target) (at <4e64905d831f4883a53259ef37fb023b>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

app_name 로컬라이징에 사용되던 /res/ 폴더 하위에 넣는 방식을 Unity 2021.3 이후에는 더이상 지원하지 않나보다.

 

그래서 검색해보니 아래 링크에 해결방법이 적혀있다.

 

[링크] https://develop.hateblo.jp/entry/android-res-error

 

【Unity】Androidのresフォルダがビルドエラーになる場合の対処法 - AppSeedのアプリ開発ブログ

最近、Unityを2021.3.9f1にアップデートしたのですが、Assets/Plugin/Android/res に配置していたフォルダの部分で下記のようなエラーが出るようになってしまいました。今回はこの対処法についてメ

develop.hateblo.jp

해결방법은 링크의 res.androidlib 폴더를 만드는 방법을 참조하면 된다.

링크의 xml 파일등이 띄어쓰기등이 좀 문제 있어서 겸사겸사 간단히 요약해서 적어 둠.

 

  [해결방법]

1. ../Assets/Plugins/Android/ 하위에 res.androidlib 폴더 생성

 

2. res.androidlib 폴더에 아래 파일을 다운받아서 추가하거나 AndroidManifest.xml 파일 직접 생성해서 입력

AndroidManifest.xml
0.00MB

[참조] AndroidManifest.xml 파일 내용

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="custom.android.res" android:versionCode="1" android:versionName="1.0">
</manifest>

 

2. res.androidlib 폴더에 아래 파일을 다운받아서 추가하거나 project.properties 파일 직접 생성해서 입력

project.properties
0.00MB

 

[참조] project.properties 파일 내용

target=android-9
android.library=true

 

3. 기존에 있던 res 폴더(하위에 values/values-en/values-ko 등 포함)를 res.androidlib 폴더로 이동

 

4. 위의 순서 진행하면 아래와 같이 된다.

res.androidlib 폴더
res 폴더(default 포함, 내가쓰는 언어들)

 

5. 이제 빌드 하면.. 된다!!

 

 

[참조] [Unity] 안드로이드 국가별 앱 이름 변경

 

[Unity] 안드로이드 국가별 앱 이름 변경

안녕하세요. 안드로이드 폰에 앱을 설치를 하면, Product Name으로 설정해놓은 이름으로 앱이 설치가 됩니다. 오늘은 앱 이름을 국가별로 다르게 설정하는 법에 대해 다루겠습니다. 일단 Assets\Plugins

scvtwo.tistory.com

[참조] Unity Android 빌드 후 국가별(언어별) 앱 이름 대응

 

Unity Android 빌드 후 국가별(언어별) 앱 이름 대응

Project Settings에서 Product Name을 이용하여 앱 이름을 설정할 수 있지만 이 경우 추후 google 및 apple에 등록한 뒤 변경이 어려운 경우가 분명 생기기 마련이고 (분명 다른 이유로라도 뭐 서버라든지 하

young-94.tistory.com

 

반응형
Posted by blueasa
, |

[사용엔진] Unity 2021.3.9f1

 

Unity 2021을 설치하고 Android 빌드를 하니 빌드 파일 위치에 'BuildFileName_BackUpThisFolder_ButDontShipItWithYourGame'라는 폴더가 생긴다.

 

난 프로젝트 메인 위치에 빌드 파일 생성하게 하다보니 'BuildFileName_BackUpThisFolder_ButDontShipItWithYourGame' 폴더가 git이 인식하는 위치에 생성되는데다

BuildFileName을 계속 넘버링하면서 만들다보니 위의 폴더도 계속 생성된다.

 

  [문제점]

1. 폴더가 파일명에 맞게 계속 생성돼서 계속 많아진다.(SSD/HDD 용량이슈 등)

2. 생성되는 폴더 위치가 git 관리 영역이라 git에 생성된 파일로 보여서 문제가 생긴다.(파일 갯수도 많음)

 

그래서 유니티에 생성 안하게 하는 옵션이 없나하고 검색해 봤지만 별시리 없는 것 같고..

계속 검색하다보니 PostprocessBuild로 해당 폴더를 삭제 해버리는 방식을 사용하는 포스팅을 보고 적용해서 잘되는 것을 확인하고 올려 둔다.

 

[해결방법]

- 아래 Script를 Editor 폴더에 넣자~

 

using System.IO;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;

public sealed class WindowsIL2CPPBuildBackUpThisFolderDeleter : IPostprocessBuildWithReport
{
    public int callbackOrder => 0;
    // 확정된 폴더명은 readonly 변수로 만듬
    private readonly string m_strBackUpThisFolder_ButDontShipItWithYourGame = "BackUpThisFolder_ButDontShipItWithYourGame";

    public void OnPostprocessBuild(BuildReport report)
    {
        var summary = report.summary;
        var platform = summary.platform;

        if (platform != BuildTarget.StandaloneWindows 
            && platform != BuildTarget.StandaloneWindows64
            && platform != BuildTarget.Android  // Android 플랫폼에서도 작동하도록 추가
            && platform != BuildTarget.iOS)     // iOS 플랫폼에서도 작동하도록 추가
        {
            return;
        }

        if (summary.options.HasFlag(BuildOptions.Development))
        {
            return;
        }

        var outputPath = summary.outputPath;
        var outputDirectoryPath = Path.GetDirectoryName(outputPath);
        
        // 빌드 폴더 이름이 FileName을 따라가서 FileName을 폴더명으로 쓰도록 수정
        var outputFileName = Path.GetFileNameWithoutExtension(outputPath);
        //var productName = PlayerSettings.productName;

        var backUpThisFolderPath = $"{outputDirectoryPath}/{outputFileName}_{m_strBackUpThisFolder_ButDontShipItWithYourGame}";

        if (!Directory.Exists(backUpThisFolderPath))
        {
            return;
        }

        Directory.Delete(backUpThisFolderPath, true);
    }
}

 

아래 참조한 포스팅의 스크립트는 Windows에서 Android 플랫폼 빌드를 했을때 처리가 안되고,

BuildFileName을 제대로 찾지 못해서 스크립트 내용 중 일부를 수정해서 제대로 삭제하는 것까지 확인함.

 

[추가 처리]

혹시 몰라서 git에 잘못 올라가지 않도록, git ignore list에 아래와 같이 추가 해놓음.

[git ignore list 추가] *_BackUpThisFolder_ButDontShipItWithYourGame/

 

 

[참조] https://baba-s.hatenablog.com/entry/2022/02/08/090000

 

【Unity】Windows IL2CPP ビルドした時に生成される XXXX_BackUpThisFolder_ButDontShipItWithYourGame を自動で削

ソースコード using System.IO; using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; public sealed class WindowsIL2CPPBuildBackUpThisFolderDeleter : IPostprocessBuildWithReport { public int callbackOrder => 0; public void OnPo

baba-s.hatenablog.com

 

반응형
Posted by blueasa
, |

[사용엔진] Unity 2020.3.37f1

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

[추가]

Push 관련해서 같은 에러가 나서 확인해보니 아래 링크와 같은 처리를 요구하고 있다.

 

1. Android 12 이상에 대해서 PendingIntent 를 PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE 추가

2. AndroidManifest.xml  SCHEDULE_EXACT_ALARM 퍼미션 추가

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

>> 1.2. 둘다 처리가 필요할 듯 하다.

 

 

[참조] https://github.com/radishmedia/react-native-push-notification/pull/19

 

fix: fix for not receiving notification on android 12 by tjkang · Pull Request #19 · radishmedia/react-native-push-notificatio

Description 안드로이드에서 sdk version 을 31 로 업그레이드하고 compileSdkVersion = 31 targetSdkVersion = 31 notification 이 수신이 안되는 이슈입니다 이는 안드로이드 12 이상에 대해서 PendingIntent 를 PendingIntent.F

github.com

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

 

구글에서 API 31을 쓰라고 해서 Target API를 31로 올리고 빌드 했는데,

실행은 되지만 최신 폰(좀 안좋은 폰은 정상)에서 실행 중 아래와 같은 에러메시지를 띄우면서 크래시가 남.

----

AndroidJavaException: java.lang.IllegalArgumentException: com.xxx.xxx.xxx: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    java.lang.IllegalArgumentException: com.xxx.xxx.xxx: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

----

이리저리 찾아보니 크게 2가지 처리를 하는 것 같다.

1. AndroidManifest.xml에 exported 명시적으로 설정

2. gradle의 dependencies {}에 androidx.work:work-runtime:2.7.0 라이브러리 추가(for Java)

    - 2.7.0부터 Android 12(API31)대응을 해서 2.7.0이상을 추가하면 되는 듯

    - Unity는 mainTemplate.gradle의 dependencies {...}에 추가

    - 라이브러리 선택 사항

       = [Java] implementation 'androidx.work:work-runtime:2.7.0'  // for Unity

       = [Kotlin] implementation 'androidx.work:work-runtime-ktx:2.7.0

 

 

내 경우는 exported 관련은 이미 돼 있어서 아래와 같이 androidx.work:work-runtime:2.7.1(현재 기준 공식 최신버전)을 추가하고 해결 했다.

mainTemplete.gradle

    dependencies{

    ....

    implementation 'androidx.work:work-runtime:2.7.1'    // for Java

    ....

    }

 

[참조] https://textbox.tistory.com/entry/android-%EC%8B%A4%ED%96%89%EC%98%A4%EB%A5%98-version-31%EC%97%90%EC%84%9C-%EC%95%B1-%EC%8B%A4%ED%96%89%EC%8B%9C-%EC%98%A4%EB%A5%98

[참조] https://bacassf.tistory.com/166

[참조] https://onlyfor-me-blog.tistory.com/467

[참조] https://stackoverflow.com/questions/68228666/targeting-s-version-10000-and-above-requires-that-one-of-flag-immutable-or-fl

반응형
Posted by blueasa
, |

[링크] https://scvtwo.tistory.com/190

 

[Unity] 유니티에서 빌드한 apk가 블루스택에서 실행되지 않는 문제 해결

안녕하세요. 유니티에서 빌드해서 apk를 생성 후 블루스택에서 확인하려고 했지만 실행되지 않는 문제가 발생하여, 공유하려고 합니다. Unity 2020.3.19f1에서 발생한 문제였습니다. 휴대폰에 넣었을

scvtwo.tistory.com

 

반응형
Posted by blueasa
, |

[링크] https://rito15.github.io/posts/unity-editor-define-symbol/

 

유니티 - Scripting Define Symbol 스크립트로 제어하기

Scripting Define Symbol?

rito15.github.io

 

반응형
Posted by blueasa
, |

In Unity there is a cross-platform way to copy a string to Clipboard. Using the GUIUtility class I’m going to show you how to copy a string into the user’s Clipboard. This should work in Unity 2017 and beyond.

By using the GUIUtility class, from UnityEngine, we can fit any C# object with a ToString() function into the Clipboard!

Clipboard Extension

To make it easily accessible I made the function as a string extension. By doing it this way we can use the function on any string anywhere in the code.

using UnityEngine;

public static class ClipboardExtension
{
    /// <summary>
    /// Puts the string into the Clipboard.
    /// </summary>
    public static void CopyToClipboard(this string str)
    {
        GUIUtility.systemCopyBuffer = str;
    }
}

 

Example

Here is an example on how to copy different elements into the Clipboard using the ClipboardExtension:

public string GetSomeString()
{
    return "This is a string coming from a function!";
}

public void TestCopyToClipboard()
{
    // + Using a standard string
    string testString = "Am I in the Clipboard?";
    testString.CopyToClipboard();
    // The content of test1 is in the Clipboard now!

    // + Using a method to get a string
    GetSomeString().CopyToClipboard();
    // The content returned by GetSomeString() is in the Clipboard now!

    // + Using a C# object with a ToString() method
    Color colorTest = Color.red;
    colorTest.ToString().CopyToClipboard();
    // The string version of the object colorTest is in the clipboard now!
}

You can try out this code for yourself! Run it, then try pasting your Clipboard into a notepad. It has been tested and works on PC, Android and iOS!

 

 

[출처] https://thatfrenchgamedev.com/785/unity-2018-how-to-copy-string-to-clipboard/

 

Unity - How to copy a string to Clipboard – That French Game Dev

Cross-platform way to copy a string to Clipboard in Unity. Using the GUIUtility class I'm going to show you how to copy a string into the user's Clipboard. This should work in Unity 2017 and beyond.

thatfrenchgamedev.com

 

반응형
Posted by blueasa
, |

 

[링크] https://geukggom.tistory.com/197

 

[Firebase] 이슈 : Could not find a working python interpreter.

유니티에 파이어베이스 SDK를 추가해줬더니 다음과 같은 이슈가 발생했습니다. Could not find a working python interpreter. Please make sure one of the following is in your PATH: python..

geukggom.tistory.com

 

반응형
Posted by blueasa
, |

Unity 2018.4.36f1

Xcode 13.4.1

 

[Error Message]

[Attribution] updatePostbackConversionValue returned error: 작업을 완료할 수 없습니다.(SKANErrorDomain 오류 10.).

 

 

iOS 빌드하고 실행에 별다른 문제는 없지만 위와 같은 에러가 떠서 뭔가하고 찾아봤는데,

Apple 측 답변으로는 에러메시지는 뜨지만 정상 동작하고 있다는 것 같다.

무시..

 

[참조]

Got an answer from Apple:

There has been an issue identified starting iOS 15.3, where the view through APIs may return an "unknown error", in cases when no error has actually occurred. In 15.3 that error is ASDErrorDomain:500. In 15.4 that error is now defined in the public SDK as SKANErrorDomain:SKANErrorUnknown (value 10). However, in those cases no functional error has actually occurred. The impression was recorded by the system.

We recommend that you ignore all errors of type ASDErrorDomain:500 / SKANErrorDomain:SKANErrorUnknown (value 10), as they are not real errors. The impression is recorded on the device regardless of those errors.

 

[출처] https://developer.apple.com/forums/thread/699442

 

SKAdImpression unknown 500 error | Apple Developer Forums

In iOS 15.3 method SKAdNetwork.startImpression() returns an error in completionHandler: MyTestApp(StoreKit)[560] : SKAdNetwork: Error in remote proxy while starting view-through impression: Error Domain=ASDErrorDomain Code=500 "SKAdNetwork: Unknown error"

developer.apple.com

 

반응형
Posted by blueasa
, |

- ParticleSystem, Spine, TMP 등 Renderer를 가진 오브젝트들을 NGUI 위에 올리고 Depth를 맞추기 위한 소스

  (NGUI Widget의 Depth 제어 부분을 Renderer를 가진 오브젝트에서도 셋팅되도록 함)

- 출처에서는 ParticleSystem용으로 이름을 지어놨는데 어차피 Renderer를 가지고 있는 것들은 다 되는거라 이름 변경함

 

NGUIRendererWidget.cs
0.00MB

 

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


[AddComponentMenu("NGUI/UI/NGUI Renderer Widget")]
public class NGUIRendererWidget : UIWidget
{
    protected Renderer m_Renderer;
    protected Material m_Mat;

    public override Material material
    {
        get
        {
            return m_Mat;
        }

        set
        {
            if (m_Mat != value)
            {
                RemoveFromPanel();
                m_Mat = value;
                MarkAsChanged();
            }
        }
    }

    protected override void OnEnable()
    {
        Init();
        base.OnEnable();
    }

    protected void Init()
    {
        if (null == m_Renderer)
        {
            m_Renderer = GetComponent<Renderer>();
        }

        if (null == m_Renderer)
        {
            return;
        }

        if (null == material)
        {
            if (false == Application.isPlaying)
            {
                material = m_Renderer.sharedMaterial;
                m_Renderer.sharedMaterial = material;
            }
            else
            {
                material = m_Renderer.material;
                m_Renderer.material = material;
            }
        }
    }

    private void OnWillRenderObject()
    {
        if (null != drawCall && drawCall.finalRenderQueue != material.renderQueue)
        {
            material.renderQueue = drawCall.finalRenderQueue;
        }

        if (Application.isPlaying == true && m_Renderer.material != material)
        {
            m_Renderer.material = material;
        }
    }

    public override void OnFill(List<Vector3> verts, List<Vector2> uvs, List<Color> cols)
    {
        for (int i = 0; i < 4; i++)
        {
            verts.Add(Vector3.zero);
            uvs.Add(Vector2.zero);
            cols.Add(color);
        }
    }
}

 

[출처] https://tenlie10.tistory.com/169

 

[Unity | 유니티] NGUI와 ParticleSystem간 Depth 조정

ParticleSystem에 해당 스크립트를 추가하고 타 NGUI 컴포넌트처럼 Depth값을 조정하면 된다. UIParticleWidget.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33..

tenlie10.tistory.com

 

반응형
Posted by blueasa
, |
public class CoroutineHelper : MonoBehaviour
{
    private static MonoBehaviour monoInstance;
    
    [RuntimeInitializeOnLoadMethod]
    private static void Initializer()
    {
        monoInstance = new GameObject($"[{nameof(CoroutineHelper)}]").AddComponent<CoroutineHelper>();
        DontDestroyOnLoad(monoInstance.gameObject);
    }
    
    public new static Coroutine StartCoroutine(IEnumerator coroutine)
    {
        return monoInstance.StartCoroutine(coroutine);
    }

    public new static void StopCoroutine(Coroutine coroutine)
    {
        monoInstance.StopCoroutine(coroutine);
    }
}

 

 

사용법 :

CoroutineHelper.StartCoroutine(코루틴_함수());

CoroutineHelper.StopCoroutine(코루틴);

 

그냥 유니티 생명주기를 가진 한 싱글톤 객체에 코루틴 실행을 몰아주는 방식

가끔 MonoBehaviour 상속 안 받고 코루틴 실행하고 싶을 때가 있는데 그럴때 사용할 수 있을듯..

 

예전에 unirx(MainThreadDispatcher)한 번 사용해본적 있었는데 거기서 아이디어 얻음

 

[출처] https://gall.dcinside.com/mgallery/board/view/?id=game_dev&no=66595

 

유니티 MonoBehaviour 상속 안 받고 코루틴 사용하기 - 인디 게임 개발 마이너 갤러리

public class CoroutineHelper : MonoBehaviour{ private static MonoBehaviour monoInstance; [RuntimeInitializeOnLo

gall.dcinside.com

 

반응형
Posted by blueasa
, |