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

카테고리

분류 전체보기 (2838)
Unity3D (886)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (188)
협업 (64)
3DS Max (3)
Game (12)
Utility (140)
Etc (99)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (52)
Android (16)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (19)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

[사용엔진] 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
, |

FirebaseAuth로 Apple 로그인도 붙이고 있는데, 제목과 같은 에러가 나서 뭘 잘못했지 하고 찾다보니..

Xcode-Capabillities에서 SignInWithApple을 추가 하지 않았다.

[참조1]의 내용을 보고 코딩해놓고 주석처리 해놨던 부분 다시 추가함.

 

 

[참조1] https://coding-dahee.tistory.com/156

 

[React Native] Apple Login 애플 로그인 구현하기 / Sign in with Apple

😉 홍보 하나 하겠습니다! 성공적인 루틴 관리를 원하시나요? 지금 바로 스토어에서 "루빗"을 검색해보세요! [ 제가 직접 운영중인 어플입니다 :) ] 루빗 홈페이지 플레이스토어 앱스토어 ✨ 와

coding-dahee.tistory.com

[참조2] https://stackoverflow.com/questions/70734015/sign-in-with-apple-authorization-error-1000-unknown

 

Sign in with Apple: Authorization Error 1000 (Unknown)

I use "Sign in with Apple" using this package: https://pub.dev/packages/sign_in_with_apple I can login successfully on iPhone (real device) I can login successfully on iPad (real device)...

stackoverflow.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://easings.net/ko

 

Easing Functions Cheat Sheet

Easing functions specify the speed of animation to make the movement more natural. Real objects don’t just move at a constant speed, and do not start and stop in an instant. This page helps you choose the right easing function.

easings.net

 

반응형
Posted by blueasa
, |

[아래 링크의 방법 시도하기 전에 일단 시도해봐야 될 것]

1. 'Player Setting -> Android -> Pubilshing Settings -> Use R8'로 이동

2. 'Use R8'이 체크 안돼 있는지 확인(Non Checked)

3. 'Use R8'이 체크 안돼 있는데도 에러가 난다면, 한 번 체크 했다가 다시 체크 해제

4. 빌드 테스트

 

[에러 수정 후기]

이번에 프로젝트를 Unity2018에서 Unity 2021로 올렸는데 제목과 같은 에러가 났다.

아래 링크의 방법 해보려하다가 Unity2020에서 생성해서 만들어진 gradle을 살펴봤지만 옵션에 문제가 없어보여서 이상하다 싶어서 위에 있는 'Use R8'을 체크 한 번 했다가 다시 체크 해제를 하니 정상적으로 빌드가 된다.

예상으로는 기존에 Unity2018에서 없던 옵션인 'Use R8'이 Unity2021(2020에도 있던데 어디서부터 생긴진 봐야될듯..)에서 새로 추가되면서 기존에는 없던 옵션이 생기면서 원하지 않거나 이상한 값이 저장돼 있는게 아닐까..하고 예상해 봄.

 

[Use R8 옵션 참조]

[Unity 2018] Use R8 옵션이 없다

 

[Unity 2021] Use R8 옵션이 있다.

 

[결론]

Use R8이 꺼져있는데도 위와같은 에러를 낸다면 Use R8 체크했다가, 다시 체크해제 해보자.

안되면 아래 방법으로..

 

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

 

[참조] https://kooksdev.tistory.com/8

 

[Error] Unity WARNING: The option setting 'android.enableR8=false' is deprecated

Gradle 관련 에러 두가지 방법으로 해결할 수 있다 Try 1 Custom Gradle Properties Template를 만들어서 android.enableR8=false를 적기 Try 2 Custom Base Gradle Template를 만들어 Gradle 버전 세팅 나는 두..

kooksdev.tistory.com

 

반응형
Posted by blueasa
, |

[링크] https://ajh322.tistory.com/298

 

유니티 빌드 에러 - mainTemplate.gradle file is using the old aaptOptions noCompress property definition which does not in

증상 유니티 버전을 2019대에서 2020대로 올리고 안드로이드 빌드를 하면 mainTemplate.gradle file is using the old aaptOptions noCompress property definition which does not include types defined by unit..

ajh322.tistory.com

 

[링크2] https://codetime.tistory.com/279

 

[Error] mainTemplate.gradle file is using the old aaptOptions 처리

UnityException: Error mainTemplate.gradle file is using the old aaptOptions noCompress property definition which does not include types defined by unityStreamingAssets constant. ※ mainTemplate.grad..

codetime.tistory.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
, |