Universal Render 模式下的多組 camera 管理
項目中使用到多組 camera, 造成戰鬥表現上面被 ui 給覆蓋, 起因是因為項目使用了 ugui 並且 Can vas 設定 Render Mode 為 Screen Space - Overlay

urscos Tech.
項目中使用到多組 camera, 造成戰鬥表現上面被 ui 給覆蓋, 起因是因為項目使用了 ugui 並且 Can vas 設定 Render Mode 為 Screen Space - Overlay

最近為了處理 Google Play 升級問題, 遇到了奇怪的情況, 記錄下來, GP 要求 app 需要升級 android 版本跟支付庫版本
應用程式必須指定 Android 14 (API 級別 34) 以上版本
應用程式必須使用 Google Play 帳款服務程式庫 6.0.1 以上版本
升級上沒多想就把 unity 的版本選擇了

What went wrong:
Execution failed for task ':launcher:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-4.0.1-6197926-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
What went wrong:
Execution failed for task ':unityLibrary:processDebugAndroidTestResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-4.0.1-6197926-windows Daemon #1: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
對比了空項目確認不是 FB 跟 GooglePlayGames 庫問題, 比對兩個 AS 項目後來發現 compileSdkVersion 使用 34 就是會出錯, 後來把 compileSDKVersion 改 33 就好了
compileSdkVersion 33
在 AS 連機執行 Play 出現錯誤
INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
可能是 manifest 問題, 但 AS 沒提示哪邊有錯誤, 索性打包 aab 丟到 Google play 看看
上船完成後提示
您上傳的 APK 或 Android App Bundle 內含活動、活動別名、服務或廣播接收器,這些項目含有意圖篩選器,但沒有「android:exported」設定屬性。您無法在 Android 12 以上版本上安裝這個檔案。詳情請參閱:developer.android.com/about/versions/12/behavior-changes-12#exported
AndroidManifest.xml 缺少 export 屬性, 加入屬性到 <activity 底下就可以
android:exported="true"

上傳 google play 提交版本時出現錯誤
您的應用程式目前採用第 3.0.3 版 play 帳款服務程式庫,但至少須更新至第 5.2.1 版,才能使用 google play 的最新營利功能
這是因為上傳 aab 裡面使用到了 billing 是 3.0.3 版本的, 發現項目並沒有使用 billing 功能索性就刪除掉了
unityLibrary/build.grade
implementation(name: 'billing-3.0.3', ext:'aar') // 刪除
unityLibrary/src/main/AndroidManifest.xml
IL_0066: call System.Collections.Generic.IEnumerable`1<System.Linq.IGrouping`2<!!1,!!0>> System.Linq.Enumerable::GroupBy<System.Int32,System.Int32>(System.Collections.Generic.IEnumerable`1<!!0>,System.Func`2<!!0,!!1>)
打包了pc版本, 運行時出現錯誤, 查了下 ILRuntime 官方, 總覺得 Linq 似乎沒法用 RegisterFunctionDelegate 解決, 查了網上說的的確只能自己改寫功能
private List<int> getUniqNumList(List<int> nums)
{
List<int> ret = new List<int>();
Dictionary<int, int> groupCounts = new Dictionary<int, int>();
foreach (int num in nums)
{
if (!groupCounts.TryGetValue(num, out int oNum))
groupCounts[num] = 1;
else
groupCounts[num]++;
}
foreach(int k in groupCounts.Keys)
{
if (groupCounts[k] == 1)
ret.Add(k);
}
return ret;
}
#if ILRuntime
List<int> guess_one = this.getUniqNumList(guess_list);
#else
List<int> guess_one = guess_list.GroupBy(x => x).Where(x => x.Count() == 1).Select(x => x.Key).ToList();
#endif