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回收效率
建構資源打包到 app 後發現個問題, 遊戲啟動就黑屏, 看了日誌如下

沒看出甚麼問題重新打個包, 發現一個奇怪的錯誤, 但之前都是這樣打包也沒注意這個情況

查看了系統配置, JAVA_HOME、PATH 都是正常的, 改其他版本 Java 也沒用, 最後發現 Cocos
這個配置是配置到 java 安裝目錄而不是 bin 目錄, 修改如下就好了

打包 apk 測試遇到奇怪的問題,
[ERROR]: E/ ERROR: Uncaught TypeError: Error 6903, please go to https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md#6903 to see details., location: src/cocos-js/cc.js:0:0
官網說這是資源加載有問題, 測試了確定不是加載不到, 是在後續流程使用clone出錯
public static createEffect(path: any, cb: any, parent: any) {
this.loadRes("/gamePackages/effects/" + path, Prefab, function (err: any,
prefab: any) {
if (err) {
cb('err', null);
return;
}
//實際是這裡出錯
var node = instantiate(prefab);
if (!parent) {
parent = find("Canvas");
}
parent.addChild(node);
cb(null, node);
});
}
測試了發現instantiate(prefab) 有問題, prefab載入的並非是prefab資源
public static loadRes(url: string, type: any, cb: Function = () => { }) {
resources.load(url, (err: any, res: any) => {
if (err) {
error(err.message || err);
cb(err, res);
return;
}
cb && cb(null, res);
})
}
由於 BonusTime.Prefab 跟 BonusTime.anim 原本在同一個層級目錄所造成的, resources.load 加載到的是 animation 資源
後來把 BonusTime.anim 改名成 BonusTimeaAim.anim 結果發現 animation.on("finished" 在動畫結束後調用沒有正常調用, 查看了下 animation 配置, 估計是因為修改了命名造成
代碼裡是這樣撥放的
let ani = node.getComponent(Animation);
ani.play('bonusTime');
ani.once(Animation.EventType.FINISHED, () => {
node && node.destroy();
callback(null);
}, this);
後來把命名改回去, 拆分到不同目錄才解決問題
後來測試發現轉盤點Start會卡死, 看了看日誌也沒發現問題在哪
看了下代碼, 因為轉盤很單純的, 後來去排查老版本發現也有問題, 那就不是替換造成的了, 查了裡面的animation發現有missing, 把 animation.play 關閉後就好了