bevy-reflection

Enable runtime introspection and dynamic field access for Bevy types.

125|10|Updated Nov 22, 2022
One-click install
npx skills add https://github.com/nolantait/bevy-starter --skill bevy-reflection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bevy-reflection
Source: https://github.com/nolantait/bevy-starter/tree/main/.agents/skills/bevy-reflection
Command: npx skills add https://github.com/nolantait/bevy-starter --skill bevy-reflection

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides Bevy runtime reflection capabilities enabling dynamic field access, type registration, and trait reflection to power tooling, editors, and dynamic systems.

Core Features & Use Cases

  • Derive Reflect to enable runtime introspection, dynamic field access, and serialization.
  • Register types with AppTypeRegistry to participate in reflection-based systems, dynamic world editing, and scene operations.
  • Use reflection subtraits to categorize and access fields for generic tooling and UIs.
  • Serialize reflected data for persistence and tooling integration.

Quick Start

Derive Reflect on your Bevy types and register them with the AppTypeRegistry to enable dynamic field access and serialization.

Frequently Asked Questions about bevy-reflection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Bevy reflection for runtime introspection and dynamic field access?

Bevy reflection enables runtime introspection by deriving the Reflect trait on your types, allowing you to dynamically access fields and interact with data without compile-time type information. You then register these types to enable dynamic behavior.

How do I register types with AppTypeRegistry for scene handling and dynamic world editing?

You register types with AppTypeRegistry by inserting your Reflect-derived types into the registry resource during app setup. This registration allows your types to participate in reflection-based systems, scene operations, and dynamic world editing.

Can I serialize reflected data in Bevy 0.19 for persistence and tooling integration?

Yes, you can serialize reflected data in Bevy 0.19. Deriving Reflect on your types enables serialization capabilities, allowing you to save and load component states for persistence and editor tooling integration.

What is the best way to build dynamic UIs and tooling using Bevy reflection subtraits?

The best way to build dynamic UIs is utilizing Bevy reflection subtraits to categorize and access data fields generically. This allows tooling and editors to inspect and modify arbitrary components dynamically at runtime.

Does deriving Reflect in Bevy require any specific project setup or dependencies?

Deriving Reflect requires the Bevy framework in your project. You apply the derive macro to your structs and enums to automatically generate the necessary runtime introspection logic, enabling dynamic access without external dependencies.

When should I not use Bevy reflection for type handling?

You should avoid using Bevy reflection when compile-time static dispatch is strictly required for performance, as runtime introspection introduces overhead. Use standard typed access for performance-critical loops instead of dynamic field access.