Bevy 内置模块列表

本页列举的是 Bevy 内置提供的所有重要功能的简略表。


这些都是可以作为 system 参数使用的特殊类型。

(List in API Docs)

你的 system 函数总共最多可以有 16 个参数,如果你需要更多参数,用元组把它们包起来解决这个限制。单个元组最多可以包含 16 个成员,但可以无限地嵌套。


这些是 Bevy 默认注入的 Assets 类型。

  • Image: Pixel data, used as a texture for 2D and 3D rendering; also contains the SamplerDescriptor for texture filtering settings
  • TextureAtlas: 2D "Sprite Sheet" defining sub-images within a single larger image
  • Mesh: 3D Mesh (geometry data), contains vertex attributes (like position, UVs, normals)
  • Shader: Raw GPU shader source code, in one of the supported languages (WGSL or SPIR-V)
  • ColorMaterial: Basic "2D material": contains color, optionally an image
  • StandardMaterial: "3D material" with support for Physically-Based Rendering
  • Font: Font data used for text rendering
  • Scene: Scene composed of literal ECS entities to instantiate
  • DynamicScene: Scene composed with dynamic typing and reflection
  • Gltf: GLTF Master Asset: index of the entire contents of a GLTF file
  • GltfNode: Logical GLTF object in a scene
  • GltfMesh: Logical GLTF 3D model, consisting of multiple GltfPrimitives
  • GltfPrimitive: Single unit to be rendered, contains the Mesh and Material to use
  • AudioSource: Raw audio data for bevy_audio
  • FontAtlasSet: (internal use for text rendering)


Bevy 内置的 bundle 类型,用于 spawning 不同种类的普通实体。

(List in API Docs)

Any tuples of up to 15 Component types are valid bundles.

Bevy 3D:

Bevy 2D:

Bevy UI:


Configuration Resources

这些设置资源允许你改变 Bevy 各部分的工作方式。

其中一些会影响引擎的低级初始化,所以必须从一开始初始化时就存在才能生效。你需要在你的 app builder 开始时注入这些资源:

这些可以在开始初始化时注入,但在运行时(从 system 中)改变也是可以的。

  • ClearColor: Global renderer background color to clear the window at the start of each frame
  • AmbientLight: Global renderer "fake lighting", so that shadows don't look too dark / black
  • Msaa: Global renderer setting for Multi-Sample Anti-Aliasing (some platforms might only support the values 1 and 4)
  • GamepadSettings: Gamepad input device settings, like joystick deadzones and button sensitivities

Engine Resources


如果你需要它们的状态,或者控制 Bevy 的各个部分,就可以从你的 systems 中访问它们。

  • FixedTimesteps: The state of all registered FixedTimestep drivers
  • Time: Global time-related information (current frame delta time, time since startup, etc.)
  • AssetServer: Control the asset system: Load assets, check load status, etc.
  • Gamepads: List of IDs for all currently-detected (connected) gamepad devices
  • Windows: All the open windows (the primary window + any additional windows in a multi-window gui app)
  • WinitWindows: Raw state of the winit backend for each window
  • Audio: Use this to play sounds via bevy_audio
  • AsyncComputeTaskPool: Task pool for running background CPU tasks
  • ComputeTaskPool: Task pool where the main app schedule (all the systems) runs
  • IoTaskPool: Task pool where background i/o tasks run (like asset loading)
  • Diagnostics: Diagnostic data collected by the engine (like frame times)
  • SceneSpawner: Direct control over spawning Scenes into the main app World

Input Handling Resources

这些资源代表了不同输入设备的当前状态。从你的 systems 中读取它们来 [处理用户输入][cb::input]。


Input Events

这些 events 在有设备产生输入时发生。把它们读到 [处理用户输入][cb::input]。

System and Control Events

来自操作系统/窗口系统、或用于控制 Bevy 的事件。


太具体地在此列出各个 Component 类型的完整清单用外有限。

请直接查看:(List in API Docs)

以下列出个人认为最重要的内置 Component 类型:

  • Transform: Local transform (relative to parent, if any)
  • GlobalTransform: Global transform (in the world)
  • Parent: Entity's parent, if in a hierarchy
  • Children: Entity's children, if in a hierarchy
  • Timer: Track if a time interval has elapsed
  • Stopwatch: Track how much time has passed
  • Handle<T>: Reference to an asset of specific type
  • Visibility: Manually control visibility, whether to display the entity (hide/show)
  • RenderLayers: Group entities into "layers" and control which "layers" a camera should display
  • Camera: Camera used for rendering
  • OrthographicProjection: Orthographic projection for a camera
  • PerspectiveProjection: Perspective projection for a camera
  • Sprite: (2D) Properties of a sprite, using a whole image
  • TextureAtlasSprite: (2D) Properties of a sprite, using a sprite sheet
  • PointLight: (3D) Properties of a point light
  • DirectionalLight: (3D) Properties of a directional light
  • NotShadowCaster: (3D) Disable entity from producing dynamic shadows
  • NotShadowReceiver: (3D) Disable entity from having dynamic shadows of other entities
  • Wireframe: (3D) Draw object in wireframe mode
  • Node: (UI) Mark entity as being controlled by the UI layout system
  • Style: (UI) Layout properties of the node
  • Button: (UI) Marker for a pressable button
  • Interaction: (UI) Track interaction/selection state: if the node is clicked or hovered over
  • Text: Text to be displayed

GLTF Asset Labels

Asset path labels to refer to GLTF sub-assets.


  • Scene{}: 获取 GLTF 场景,作为 Bevy 场景
  • Node{}: 获取 GLTF Node,作为 GltfNode
  • Mesh{}: 获取 GLTF Mesh,作为 GltfMesh
  • Mesh{}/Primitive{}: 获取 GLTF Primitive,作为 Bevy Mesh
  • Texture{}: 获取 GLTF 纹理,作为 Bevy Image
  • Material{}: 获取 GLTF 材质,作为 Bevy StandardMaterial
  • DefaultMaterial: 同上一个,如果 GLTF 文件中包含一个没有索引的默认材质,则直接获取该材质。


在内部,Bevy 至少有这些内置的阶段:

  • 在主应用程序(CoreStage)中:FirstPreUpdateUpdatePostUpdateLast
  • 在渲染子程序(RenderStage)中:ExtractPrepareQueuePhaseSortRenderCleanup