Giter Site home page Giter Site logo

bevy_dyn_component's Introduction

bevy_dyn_component

Usage

Add dynamic_components_plugin to your App:

use bevy_dyn_component::prelude::*;
...
app.add_plugins(dynamic_components_plugin);

This initializes the component type registry needed for some of the unsafe sections. After that, you can use the dynamic_component and insert_dynamic APIs:

#[derive(Component)]
struct DynamicMarker;

let marker0 = world.dynamic_component::<DynamicMarker>();
world.entity_mut(e).insert_dynamic(marker0, DynamicMarker);

The component ID can also be used in the query builder API.

Future of this crate

Now that Bevy supports dynamic components, it's likely that this crate will soon be obsolete. In the longer term, many of the things you can do with this crate is easier with relations.

Examples

Demonstrates basic usage of the library, how to create dynamic components with a layout matching an existing component, how to insert them into entities, and how to use them in the query builder API.

Demonstrates a simple way of using dynamic components as janky fragmenting relations. In my opinion, it doesn't work well as a general-purpose relations pattern, but for specific cases, it can be handy.

Bevy Version

bevy bevy_dyn_component
0.13 0.1-0.2

Contribution

PRs welcome. If Bevy doesn't get good first-class support for this soon, I'll probably just keep updating this. It has missing APIs, for example, take_dynamic. I probably won't be adding this until I need it in a project, but I also won't hesitate to merge it in if someone else wants to tackle it.

bevy_dyn_component's People

Contributors

jnhyatt avatar

Stargazers

wdhwg001 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.