分類 Unity 下的文章

在 Unity 專案中,部分 texture 的 .meta 檔案每次開啟 Editor 後都會自動出現變動,即使執行 git discard 還原,下次開啟 Unity 仍然會重新產生相同的 diff。

變動內容固定是在 platformSettings 區塊新增一段 Android override:

- serializedVersion: 4
  buildTarget: Android
  maxTextureSize: 2048
  resizeAlgorithm: 0
  textureFormat: -1
  textureCompression: 1
  compressionQuality: 50
  crunchedCompression: 0
  allowsAlphaSplitting: 0
  overridden: 0
  ignorePlatformSupport: 0
  androidETC2FallbackOverride: 0
  forceMaximumCompressionQuality_BC6H_BC7: 0

這個 overridden: 0 代表這段 override 並沒有自訂任何值,全是預設,這點微妙。

- 閱讀剩餘部分 -

最近在研究如何有效的製作動畫表現, 找了下想起了之前適用的 xNode, 也順帶找到官方支援的 visual script 索性就試試看
這個是用程式方式實現的功能, 功能要就是設定物件位置、生成效果 prefab、顯示傷害數字、刪除生成資源,并不複雜
73864-rpi5j9l5g0p.png

- 閱讀剩餘部分 -

最近為了處理 Google Play 升級問題, 遇到了奇怪的情況, 記錄下來, GP 要求 app 需要升級 android 版本跟支付庫版本

應用程式必須指定 Android 14 (API 級別 34) 以上版本
應用程式必須使用 Google Play 帳款服務程式庫 6.0.1 以上版本

升級上沒多想就把 unity 的版本選擇了
35871-2q1hox2wlp8.png

運行 As 最後執行 Make Project 出現錯誤
1: Task failed with an exception.

  • 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.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    2: Task failed with an exception.

  • 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