Bevy Scene hook

Bevy tracking Latest version Apache 2.0 Documentation

A proof of concept for adding components ad-hoc within code to entities spawned through scenes (such as gltf files) in the [bevy game engine].

If you don't mind adding such a small dependency to your code rather than copy/pasting the code as a module, you can get it from [crates.io].

Usage

toml [dependencies] bevy-scene-hook = "4.0"

The following snippet of code is extracted from Warlock's Gambit source code.

It loads the scene.glb file when the game starts. When the scene is fully loaded, the closure passed to with_comp_hook is ran for each entity with a Name component present in the scene. We add a Graveyard component to the Entity containing the SceneHook, so that it can later be checked for whether the scene completed loading.

It is possible to name object in glb scenes in blender using the Outliner dock (the tree view at the top right) and double-clicking object names.

See the examples in the API doc for usage.

Change log

Version matrix

| bevy | latest supporting version | |------|--------| | 0.8 | 4.0.0 | | 0.7 | 3.1.0 | | 0.6 | 1.2.0 |

License

This library is licensed under Apache 2.0.