https://github.com/arkntools/unity-js
Unity AssetBundle 解包
https://github.com/arkntools/unity-js
assetsbundle unity unpacker
Last synced: 22 days ago
JSON representation
Unity AssetBundle 解包
- Host: GitHub
- URL: https://github.com/arkntools/unity-js
- Owner: arkntools
- License: agpl-3.0
- Created: 2023-06-24T08:29:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-06T16:09:53.000Z (11 months ago)
- Last Synced: 2024-06-09T13:47:19.457Z (11 months ago)
- Topics: assetsbundle, unity, unpacker
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@arkntools/unity-js
- Size: 300 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unity-js
[](https://www.npmjs.com/package/@arkntools/unity-js)
JS implementation of Unity AssetBundle unpacking.
Only the minimum implementation required for the project was done. If you need complete functionality, it is recommended to use a more complete library in other languages.
Currently only supports:
- TextAsset
- Texture2d
- Sprite
- SpriteAtlas```js
import fs from 'fs';
import { loadAssetBundle, AssetType, BundleEnv } from '@arkntools/unity-js';(async () => {
const bundle = await loadAssetBundle(fs.readFileSync('character_table003334.ab', { env: BundleEnv.ARKNIGHTS }));
for (const obj of bundle.objects) {
if (obj.type === AssetType.TextAsset) {
fs.writeFileSync(`${obj.name}.bytes`, obj.data);
break;
}
}
})();(async () => {
const bundle = await loadAssetBundle(fs.readFileSync('spritepack_ui_char_avatar_h1_0.ab', { env: BundleEnv.ARKNIGHTS }));
for (const obj of bundle.objects) {
if (obj.type === AssetType.Sprite && obj.name === 'char_002_amiya') {
fs.writeFileSync(`${obj.name}.png`, await obj.getImage()!);
break;
}
}
})();(async () => {
const bundle = await loadAssetBundle(fs.readFileSync('char_1028_texas2.ab', { env: BundleEnv.ARKNIGHTS }), {
// Some sprites may not give the PathID of the alpha texture, you can provide a custom function to find it.
findAlphaTexture: (texture, assets) =>
assets.find(({ name }) => name === `${texture.name}[alpha]`),
});
for (const obj of bundle.objects) {
if (obj.type === AssetType.Sprite && obj.name === 'char_1028_texas2_1') {
fs.writeFileSync(`${obj.name}.png`, await obj.getImage()!);
break;
}
}
})();
```## References
- [Perfare/AssetStudio](https://github.com/Perfare/AssetStudio)
- [RazTools/Studio](https://github.com/RazTools/Studio)
- [K0lb3/UnityPy](https://github.com/K0lb3/UnityPy)
- [yuanyan3060/unity-rs](https://github.com/yuanyan3060/unity-rs)
- [MooncellWiki/UnityPy](https://github.com/MooncellWiki/UnityPy)