AssetStudioGUI 使用
AssetStudioGUI 可以用來查看 Unity 包體內容, 可以多看看其他優質產品的資源內容怎麼做的
首先開啟 AssetStudioGUI

將 unity 的包給解壓, 用來測試的是之前上傳 Google Play 的 RummyGo aab包

AssetStudioGUI 點擊 文件->加載目錄, 選擇解壓目錄

切換到資源列表, 並點類型排序

可以直接查看包體內容

urscos Tech.
AssetStudioGUI 可以用來查看 Unity 包體內容, 可以多看看其他優質產品的資源內容怎麼做的
首先開啟 AssetStudioGUI

將 unity 的包給解壓, 用來測試的是之前上傳 Google Play 的 RummyGo aab包

AssetStudioGUI 點擊 文件->加載目錄, 選擇解壓目錄

切換到資源列表, 並點類型排序

可以直接查看包體內容

打包app執行轟炸超人發現遊戲開局就crash了....


在pc上複查發現這個錯誤

最後發現是這邊出錯, int[,]在查詢數據時 address 不知道為什麼出錯了
for (int j = 0; j < map.MapConfig.ChunkH; j++){
strm += "[";
for (int i = 0; i < map.MapConfig.ChunkW; i++){
//這邊出錯
strm += matrixData[j, i] + ",";
}
strm += "],";
}
strm += "]";
詳細錯誤如下
IL_00af: call System.Int32& System.Int32[0...,0...]::Address(System.Int32,System.Int32)
at ETHotfix.AIPlayer.calcNonPath(System.Int32 depth) (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:366)
at ETHotfix.AIPlayer.calcPath() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:200)
at ETHotfix.AIPlayer.V_Think() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:86)
at ETHotfix.AIPlayer.think() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:79)
at ETHotfix.AILogic.UpdateLogic() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AILogic.cs:292)
at ETHotfix.BaseEntity.updateAILogicAct() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/Entity/BaseEntity.cs:1581)
代碼修改, 把查詢給int再使用就好了
for (int j = 0; j < map.MapConfig.ChunkH; j++){
strm += "[";
for (int i = 0; i < map.MapConfig.ChunkW; i++){
num = matrixData[j, i];
strm += num + ",";
}
strm += "],";
以後有空再來查這個問題
在使用 ILRuntime需要注意
升級 ILRuntime 到 2.x 版本在 1.6 版本打包Android(package Hotfix.dll by Release)跟 Editor 下的性能非常糟糕,所有的消耗都在 GC 上面,後來升級 2.x 版本就好了
從更新後重新生成 ILBinding 發現修改了 IList 改成 using AutoList,這部分應該是優化了GC回收效率
今天用了animaiton編技能效果, 上次使用已經是 2013年的時候了, 測試了下就上手, 但奇怪的是 image.sprite 的更改一直無效, 可以看到 image.sprite 上面已經紀錄了不同 frame 下的 sprite, 但 run 起來就是無效

查了下發現不能用老版 animation 必須改用 animator, 因為 ugui.image 是在老版後面才出現的功能, unity 沒有回頭去更新 animation 功能, 下面我們就來新增新版本試試看
老版本跟新版本區別在創建流程不同跟添加 component 不一樣
老版本是在 GameObject 新增 Animation Component, 然後開啟 Windows -> Animation -> Animation, Create 新增 Animation Clip, 這樣就是使用 animation 運行

如果要搭配 animator, 則 GameObject 無須新增, 直接開啟 Windows -> Animation -> Animation, Create 新增 Animation Clip, 查看 unity 會新增 animation clip 跟 animation controller 兩個檔案並且 GameObject 是新增了 Animator Component, 在這個情況下去編輯 Image.Sprite 就正常

測試某個插件導入到項目中出現問題, 一般這個問題是因為版本不匹配造成的, 因為直接比對了兩項目的 package 將差異 "com.unity.render-pipelines.universal": "10.6.0", 加入目前項目就出現這個問題

需要查詢 com.unity.render-pipelines.universal 對應 unity 版本, 在官網的插件中選擇版本下拉清單可以查看到對應 unity 版本

隨便改成了 12.0.0 版本, 目測服務器沒有這個版本

查看 Package Manager 顯示是 not found

再切回去官網查目前最新 12.1.15, 但還是 not found

後來打開 Package Manager 查詢支持, 名字是 Universal RP, 版本 12.1.7 執行 import

import 完成後出現錯誤, 場景變紫色
Shader error in Couldn't open include file 'Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl'. at line 59

這是URP升級造成的, 生成一個URP Asset如下

開啟 Player Settingg -> Graphics, 將 URP Asset 拖拉近來, 再回到場景就好了

參考:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/manual/index.html
https://blog.csdn.net/q764424567/article/details/133927994