Unity3d AssetBundle基本格式分析

2021-06-29 15:51:26 字數 1308 閱讀 9881

參考

disunity 和雲風的分析

寫的c#版本的 assetbundle基本格式分析工具:

assertbundle檔案頭: 

public void read(bytearray bs));}

if (streamversion >= 2)

if (streamversion >= 3)

bs.readbyte();

}

assetbundle具體資料使用lzma壓縮(開源庫:

sevenzip.compression.lzma.decoder coder = new sevenzip.compression.lzma.decoder();

uint length = (uint) (fs.length - header.getheadersize());

byte inbytes = new byte[length];

indata.readbytes(inbytes, 0, length);

memorystream input = new memorystream(inbytes);

memorystream output = new memorystream();

// read the decoder properties

byte properties = new byte[5];

input.read(properties, 0, 5);

// read in the decompress file size.

byte filelengthbytes = new byte[8];

input.read(filelengthbytes, 0, 8);

long filelength = bitconverter.toint64(filelengthbytes, 0);

coder.setdecoderproperties(properties);

coder.code(input, output, input.length, filelength, null);

output.position = 0;

解壓後的資料格式如下,一般只包含乙個asset:

uint files = indata.readuint();

debug.log(files);

for (int i = 0; i < files; i++)

其中objectinfo的classid含義可參見:

Unity學習筆記 3

rigidbody 剛體元件,使物體具有重力效果,碰撞 呼叫剛體裡的方法 verctor3 向量,1,0,0 向x的方向施加乙個力 rd.addforce new vector3 1,0,0 得到水平的乙個值,返回 1 1之間的數,相當於a d建 float h input.getaxis hori...

Unity3D開發(九) Unity3d流光效果

遊戲開 壇 hello game 遊戲開發群 201276069 之前曾經注意過material 中紋理的屬性都有 tiling 和offset 但沒有深究過其用途,今天才知道竟然可以利用 offset做uv 動畫,從而完成各種有趣的動畫,比如流光效果!流過效果即通常一條高光光在物體上劃過,模擬高光...

Unity3D高階4 6 Unity3D 多執行緒

unity3d從入門到高階 文章目錄及設定這個專欄的初衷 大家是不是一看這個標題都想吐槽了,因為很多資料都介紹unity不支援多執行緒,unity的多執行緒其實都是協程等等說法,然而協程也並不是真正的多執行緒。協程其實是等某個操作完成之後再執行後面的 或者說是控制 在特定的時機執行。那unity到底...