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값입니다. 소스 또는 대상 컬러가 완전히 표시되도록 하려면 이 값을 사용합니다.
정리하자면 소스 알파 값이란 새로 그려진 이미지의 알파 값이고 스테이지 값은 기존 화면에 그려져 있는 값인데 이둘을 곱하면 새로 그려진 이미지의 알파값을 따라가기 때문에 이를 1값으로 변경해 새로 그려진 이미지의 알파 값을 따라가지 않게 수정 함으로써 해결 됬다고 생각한다.
위와 같은 문제 때문이 었다면 RenderTexture 를 통하지 않고 직접 그리는 이미지에서도 해당 상황이 재현되야 하지 않을까?하지만 직접 그리는 이미지에서는 해당 이슈가 발생하지 않는다.
RenderTexture 설정이 잘못되어 출력이 잘못 되고 있는 것은 아닐까?
RenderTexture 의 Color Format 설정을 바꿔보니 다음 두 경우에 원했던 형태의 출력이 되는 것을 확인 하였다.
I encountered a very similar issue and found it was caused by the antivirus software. By suspending the antivirus process, I was able to work around the problem.
Try configuring your AV to "exclude" your project directory, but if that fails then you'll need to either disable or temporarily suspend the AV's process.
This release is not compliant with the Google Play 64-bit requirement
The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 93.
Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code it needs. This avoids increasing the overall size of your app.
* What went wrong: Execution failed for task ':packageRelease'. > 1 exception was raised by workers: java.io.UncheckedIOException:java.io.IOException: Failed to obtain compression information for entry
해결책은 아래와 같다.
Minify-Release/Debug가 기본 None인데, 업데이트 되면서 값을 넣어야 되나보다.
Proguard 이야기도 있긴한데, 우선 아래 보이는대로 Gradle (Experimental) 로 바꾸니 빌드가 잘 된다.
Someone inthe thread from unity forumfinally posted a working solution. I'm gonna share it here as well so hopefully everyone who lands on the question with this issue will not have to spend 30 hours blindfolded, resolving dex merging conflicts like I did.
Turns out that with new new version there is a few more options in thepublish settingsthat needs to be set!
quotingRealPpTheBests' answer
Go to player settings > Project Settings > Minify, in there, there will be an option of Release, set it to Gradle .
For some reason when choosing gradle build these two are not automatically toggled, and maybe in some cases they don't have to be. But setting minify toGrable (experimental)completely resolved all the build errors I was getting after updating unity.
EDIT: september-2019 - Solution above should still work, but:
I have lately been experimenting with choosingProguardinstead of the experimental Gradle minifier (can be selected in the dorpdown as well). When configured correctly proguard will also resolve your DEX limitation errors, and get rid of unused code and even compress your build size even more.
This posthas a quite throughly detailed guide on how to enable and configure it. Keep in mind though, that the configuration will be unique to which dependencies you are using, so you will have to read up and do some custom configuration here most likely.
Project Settings -> Player -> Publishing Settings -> Minify -> For Both Release and Debug = "Proguard" solved the problem (after importing Facebook SDK)– Ahmet HayrullahogluNov 23 '19 at 9:56
1
Glad to hear that my edited solution from September also worked in your case! That means it will probably work for more people.– Rasmus PulsNov 24 '19 at 19:26
Traceback (most recent call last): File "", line 446, in File "", line 289, in main File "", line 228, in argv_as_unicode_win32 AttributeError: 'module' object has no attribute 'wintypes' generate_xml_from_google_services_json returned -1
Firebase 6.9.0을 유니티에 Import하고 위와 같은 에러를 보게 됐다.
결론적으로 wintypes attribute가 없다는 말인데 저게 뭔지 몰라서 한참 찾아 헤메다가
구글링으로 이것 저것 같아 보았는데, compileSdkVersion 와 com.android.support:appcompat-v7을 28로 올리면 해결된다는 글이 많았습니다.
그래서 원인을 찾아보고 해결 방법을 찾았습니다.
[오류]
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found.,
sources=[C:\*****\*****\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\4fbc79d932923de1fd1d9a6e9b479d50\res\values\values.xml:246:5-69], original message=, tool name=Optional.of(AAPT)}
error: resource android:attr/ttcIndex not found.
Message{kind=ERROR, text=error: resource android:attr/ttcIndex not found.,
sources=[C:\*****\*****\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\4fbc79d932923de1fd1d9a6e9b479d50\res\values\values.xml:246:5-69], original message=, tool name=Optional.of(AAPT)}
[원인]
애드몹의 SDK 최신 버전이 18로 이번주에 배포 되어 있는데, 이 SDK의 경우 Android API 28(안드로이드 9) 에서 최적화 된듯 합니다.
gradle의 dependencies에서 최신의 애드몹 SDK를 참조하고 있고, Andorid API가 27 이하인 경우에 발생합니다.
[해결]
모듈 gradle에서 참조하고 있는 애드몹의 SDK의 버전을 17로 설정하면 컴파일 오류가 해결됩니다.
Unity에서 Firebase Cloud Messaging(FCM) 서비스 적용 후 빌드 시, 애플로부터 Missing Push Notification Entitlement 메시지를 받을 때가 있는데 어느 순간 부터 XCode에서 Capabilities-Push Notifications를 수동으로 ON 시켜줘야 된단다.
[참조]
7단계: 사용자 알림 프레임워크 추가
Xcode 프로젝트를 클릭한 후Editor area(편집 영역)에서General(일반)탭을 클릭합니다.
Linked Frameworks and Libraries(연결된 프레임워크 및 라이브러리)까지 아래로 스크롤한 다음+버튼을 클릭하여 프레임워크를 추가합니다.
나타나는 창에서UserNotifications.framework까지 스크롤하여 해당 항목을 클릭한 다음Add(추가)를 클릭합니다.
8단계: 푸시 알림 사용 설정
Xcode 프로젝트를 클릭한 후Editor area(편집 영역)에서Capabilities(기능)탭을 클릭합니다.
Push Notifications(푸시 알림)를 On(켜기)으로 전환합니다.
Background Modes(백그라운드 모드)까지 아래로 스크롤하고On(켜기)으로 전환합니다.