An open API service indexing awesome lists of open source software.

https://github.com/jakobhellermann/unity-scene-repacker

Repack unity level files into (potentially filtered) asset bundles you can load at runtime
https://github.com/jakobhellermann/unity-scene-repacker

Last synced: 11 months ago
JSON representation

Repack unity level files into (potentially filtered) asset bundles you can load at runtime

Awesome Lists containing this project

README

          

# unity-scene-repacker

![demo asciicast](./docs/demo-cast.svg)

When modding a unity game, you often want to `Instantiate` objects from a scene that isn't loaded.
One solution for this is to load all the scenes you're interested in at startup, copy the gameobjects somewhere and unload the scene.
This works, but is slow and memory intensive.

This project lets you read scenes from the distributed game, take only what you need, and package those objects into an [AssetBundle](https://docs.unity3d.com/Manual/AssetBundlesIntro.html) that you can load at runtime.

## Installation

```sh
uv tool install unity-scene-repacker # if you have uv installed
cargo install --git https://github.com/jakobhellermann/unity-scene-repacker --locked # to compile from source
```

## Usage

```jsonc
objects.json
{
"Fungus1_12": [
"simple_grass",
"green_grass_2",
"green_grass_3",
"green_grass_1 (1)"
],
"White_Palace_01": [
"WhiteBench",
"White_ Spikes"
],
...
}
```

```sh
unity-scene-repacker
--steam-game 'Hollow Knight'
--objects objects.json \
--output mybundle.unity3d
```

```
Usage: unity-scene-repacker [OPTIONS] <--game-dir |--steam-game >

Options:
-h, --help
Print help (see a summary with '-h')

-V, --version
Print version

Game options:
--game-dir
Directory where the levels files are, e.g. steam/Hollow_Knight/hollow_knight_Data

--steam-game
App ID or search term for the steam game to detect

Repack options:
--scene-objects
Path to JSON file, containing a map of scene name to a list of gameobject paths to include

{
"Fungus1_12": [
"simple_grass",
"green_grass_2",
],
"White_Palace_01": [
"WhiteBench",
]
}

Output options:
--mode
[default: scene]

Possible values:
- scene: Contains filtered 1:1 scenes you can load via LoadScene
- asset: A single bundle letting you load specific objects using LoadAsset

--disable
When true, all gameobjects in the scene will start out disabled

--compression
Compression level to apply

[default: lzma]

Possible values:
- none
- lzma
- lz4hc: Best compression at the cost of speed

-o, --output
[default: out.unity3d]

--bundle-name
Name to give the assetbundle. Should be unique for your game
```