|bevy vewsion:|0.11|(outdated!)| |---|---|---|
As this page is outdated, please refer to Bevy's official migration guides while reading, to cover the differences: 0.11 to 0.12, 0.12 to 0.13, 0.13 to 0.14.
I apologize for the inconvenience. I will update the page as soon as I find the time.
wist of bevy buiwtins
this page is a quick condensed wisting o-of aww the i-impowtant things p-pwovided by bevy.
- systempawams
- assets
- fiwe fowmats
- gwtf asset wabews
- shadew impowts
wgpubackends- scheduwes
- wun conditions
- pwugins
- bundwes
- wesouwces (configuwation)
- wesouwces (engine usew)
- wesouwces (input)
- events (input)
- events (engine)
- events (system/contwow)
- components
systempawams
these awe aww the speciaw types that c-can be used a-as system pawametews.
in weguwaw systems:
Commands: manipuwate the ecs using commandsQuery<T, F = ()>(can contain tupwes of up to 15 t-types): access to entities and componentsRes<T>: shawed access to a wesouwceResMut<T>: excwusive (mutabwe) access to a wesouwceOption<Res<T>>: shawed access to a wesouwce that m-may nyot existOption<ResMut<T>>: excwusive (mutabwe) access to a wesouwce that may n-nyot existLocal<T>: data wocaw to the systemEventReader<T>: weceive eventsEventWriter<T>: send events&World: wead-onwy diwect access to the ecs wowwdParamSet<...>(with up to 8 pawams): wesowve confwicts between incompatibwe system p-pawametewsDeferred<T>: custom "defewwed mutation", XD simiwaw toCommands, >_< but fow youw own thingsRemovedComponents<T>: wemovaw detectionGizmos: a way to dwaw wines and shapes on the scween fow debugging and d-dev puwposesDiagnostics: a way to wepowt measuwements/debug data to bevy fow twacking and visuawizationSystemName: the nyame (stwing) of the system, ^•ﻌ•^ m-may be usefuw fow d-debuggingParallelCommands: abstwaction to hewp useCommandswhen you wiww do youw own pawawwewismWorldId: the wowwd id of the wowwd the system is wunning onComponentIdFor<T>: get theComponentIdof a given component typeEntities: wow-wevew ecs metadata: aww entitiesComponents: wow-wevew ecs metadata: aww componentsBundles: wow-wevew ecs metadata: aww bundwesArchetypes: wow-wevew ecs metadata: aww awchetypesSystemChangeTick: wow-wevew ecs metadata: tick used f-fow change detectionNonSend<T>: shawed access to non-Send(main thwead onwy) dataNonSendMut<T>: excwusive access to non-Send(main thwead onwy) dataOption<NonSend<T>>: shawed access to non-Send(main thwead onwy) data that may n-nyot existOption<NonSendMut<T>>: excwusive access to non-Send(main thwead onwy) data that may n-nyot existStaticSystemParam: hewpew fow genewic system abstwactions, ^•ﻌ•^ t-to avoid w-wifetime annotations- tupwes containing any of these types, ^•ﻌ•^ w-with up to 16 m-membews
- [
&mut World]: fuww diwect access to the ecs wowwd - [
Local<T>]: data wocaw to the system - [
&mut SystemState<P>][SystemState]: emuwates a weguwaw system, OwO awwowing y-you to easiwy a-access data fwom t-the wowwd.Pawe the system pawametews. - [
&mut QueryState<Q, F = ()>][QueryState]: awwows you to pewfowm quewies on t-the wowwd, ^•ﻌ•^ simiwaw t-to a [Query] in weguwaw systems.
youw function can have a maximum o-of 16 totaw pawametews. OwO i-if you need m-mowe, gwoup them into tupwes to wowk awound t-the wimit. OwO t-tupwes can contain u-up to 16 membews, >_< but can be nyested indefinitewy.
systems wunning duwing the extwact scheduwe can awso use
Extract<T>, (ꈍᴗꈍ) to access data fwom the main wowwd i-instead of the
wendew wowwd. XD T can be any wead-onwy system pawametew t-type.
assets
(mowe info about wowking with assets)
these awe the asset types wegistewed b-by bevy by defauwt.
Image: pixew data, (ꈍᴗꈍ) used as a textuwe fow 2d a-and 3d wendewing; awso contains theSamplerDescriptorfow textuwe fiwtewing settingsTextureAtlas: 2d "spwite sheet" defining sub-images w-within a singwe w-wawgew imageMesh: 3d mesh (geometwy data), OwO contains v-vewtex attwibutes (wike p-position, 🥺 u-uvs, nyowmaws)Shader: gpu shadew code, in one of the suppowted w-wanguages (wgsw/spiw-v/gwsw)ColorMaterial: basic "2d matewiaw": contains cowow, ^•ﻌ•^ o-optionawwy an i-imageStandardMaterial: "3d matewiaw" with suppowt fow physicawwy-based wendewingAnimationClip: data fow a singwe animation sequence, ^•ﻌ•^ c-can be used w-withAnimationPlayerFont: font data used fow text wendewingScene: scene composed of witewaw ecs entities t-to instantiateDynamicScene: scene composed with dynamic typing a-and wefwectionGltf: gwtf mastew asset: index of the entiwe contents of a-a gwtf fiweGltfNode: wogicaw gwtf object in a sceneGltfMesh: wogicaw gwtf 3d modew, (ꈍᴗꈍ) consisting o-of muwtipweGltfPrimitivesGltfPrimitive: singwe unit to be wendewed, ^•ﻌ•^ contains t-the mesh and m-matewiaw to useAudioSource: audio data fowbevy_audioFontAtlasSet: (intewnaw use fow text wendewing)SkinnedMeshInverseBindposes: (intewnaw use fow skewetaw animation)
fiwe fowmats
these awe the asset fiwe fowmats (asset w-woadews) s-suppowted by bevy. OwO s-suppowt fow each one can be enabwed/disabwed u-using cawgo featuwes. XD some awe enabwed by defauwt, (ꈍᴗꈍ) many awe n-nyot.
image fowmats (woaded as Image assets):
|fowmat |cawgo featuwe |defauwt?|fiwename extensions |
|----------|-------------------|--------|------------------------------|
|png |"png" |yes |.png |
|hdw |"hdr" |yes |.hdr |
|ktx2 |"ktx2" |yes |.ktx2 |
|ktx2+zstd |"ktx2", "zstd" |yes |.ktx2 |
|jpeg |"jpeg" |no |.jpg, rawr x3 .jpeg |
|webp |"webp" |no |.webp |
|openexw |"exr" |no |.exr |
|tga |"tga" |no |.tga |
|pnm |"pnm" |no |.pam, rawr x3 .pbm, rawr x3 .pgm, rawr x3 .ppm|
|bmp |"bmp" |no |.bmp |
|dds |"dds" |no |.dds |
|ktx2+zwib |"ktx2", "zlib" |no |.ktx2 |
|basis |"basis-universal"|no | .basis |
audio fowmats (woaded as AudioSource assets):
|fowmat |cawgo featuwe|defauwt?|fiwename extensions |
|----------|-------------|--------|-----------------------|
|ogg vowbis|"vorbis" |yes |.ogg, rawr x3 .oga, rawr x3 .spx |
|fwac |"flac" |no |.flac |
|wav |"wav" |no |.wav |
|mp3 |"mp3" |no |.mp3 |
3d asset (modew ow scene) fowmats:
|fowmat|cawgo featuwe|defauwt?|fiwename extensions|
|------|-------------|--------|-------------------|
|gwtf |"bevy_gltf"|yes |.gltf, rawr x3 .glb |
shadew fowmats (woaded as Shader assets):
|fowmat|cawgo featuwe |defauwt?|fiwename extensions |
|------|-----------------------|--------|-------------------------|
|wgsw |n/a |yes |.wgsl |
|gwsw |"shader_format_glsl" |no |.vert, rawr x3 .frag, rawr x3 .comp|
|spiw-v|"shader_format_spirv"|no |.spv |
font fowmats (woaded as Font assets):
|fowmat |cawgo featuwe|defauwt?|fiwename extensions|
|--------|-------------|--------|-------------------|
|twuetype|n/a |yes |.ttf |
|opentype|n/a |yes |.otf |
bevy scenes:
|fowmat |fiwename extensions|
|--------------------|-------------------|
|won-sewiawized scene|.scn,.scn.ron |
thewe awe unofficiaw pwugins avaiwabwe f-fow adding s-suppowt fow even m-mowe fiwe fowmats.
gwtf asset wabews
asset path wabews to wefew to gwtf s-sub-assets.
the fowwowing asset wabews awe suppowted ({} is the nyumewicaw index):
Scene{}: gwtf scene as bevySceneNode{}: gwtf nyode asGltfNodeMesh{}: gwtf mesh asGltfMeshMesh{}/Primitive{}: gwtf pwimitive as bevyMeshMesh{}/Primitive{}/MorphTargets: mowph tawget animation data fow a-a gwtf pwimitiveTexture{}: gwtf textuwe as bevyImageMaterial{}: gwtf matewiaw as bevyStandardMaterialDefaultMaterial: as above, OwO if the gwtf fiwe contains a-a defauwt matewiaw w-with nyo i-indexAnimation{}: gwtf animation as bevyAnimationClipSkin{}: gwtf mesh skin as bevySkinnedMeshInverseBindposes
shadew impowts
todo
wgpu backends
wgpu (and hence bevy) suppowts the fowwowing b-backends:
|pwatfowm|backends (in owdew of pwiowity)| |--------|-------------------------------| |winux |vuwkan, XD gwes3 | |windows |diwectx 12, XD vuwkan, gwes3 | |macos |metaw | |ios |metaw | |andwoid |vuwkan, XD gwes3 | |web |webgpu, XD webgw2 |
on gwes3 and webgw2, OwO some wendewew f-featuwes awe unsuppowted a-and pewfowmance i-is wowse.
webgpu is expewimentaw and few bwowsews s-suppowt it.
scheduwes
intewnawwy, >_< bevy has these buiwt-in scheduwes:
Main: wuns evewy fwame update cycwe, ^•ﻌ•^ to p-pewfowm genewaw a-app wogicExtractSchedule: wuns aftewMain, ^•ﻌ•^ to copy data fwom the main wowwd i-into the wendew w-wowwdRender: wuns aftewExtractSchedule, ^•ﻌ•^ to pewfowm aww wendewing/gwaphics, OwO i-in pawawwew w-with the nyextMainwun
the Main scheduwe simpwy wuns a sequence o-of othew scheduwes:
on the fiwst wun (fiwst fwame update o-of the app):
on evewy wun (contwowwed via the MainScheduleOrder wesouwce):
First: any initiawization that must be d-done at the stawt o-of evewy fwamePreUpdate: fow engine-intewnaw systems intended t-to wun befowe u-usew wogicStateTransition: pewfowm any pending state twansitionsRunFixedUpdateLoop: wuns theFixedUpdatescheduwe as many times as nyeededUpdate: fow aww usew wogic (youw systems) t-that shouwd wun e-evewy fwamePostUpdate: fow engine-intewnaw systems intended t-to wun aftew u-usew wogicLast: any finaw cweanup that must be d-done at the end o-of evewy fwame
FixedUpdate is fow aww usew wogic (youw systems) t-that shouwd w-wun at a fixed timestep.
StateTransition wuns the
OnEnter(...)/OnTransition(...)/OnExit(...)
scheduwes fow youw states, >_< when you want to change state.
the Render scheduwe is owganized using sets (RenderSet):
ExtractCommands: appwy defewwed buffews fwom systems that wan inExtractSchedulePrepare/PrepareFlush: set up data on the gpu (buffews, (ꈍᴗꈍ) t-textuwes, etc.)Queue/QueueFlush: genewate the wendew jobs to be w-wun (usuawwy phase items)PhaseSort/PhaseSortFlush: sowt and batch phase items fow efficient wendewingRender/RenderFlush: exekawaii~ the wendew gwaph to actuawwy twiggew the gpu to do w-wowkCleanup/CleanupFlush: cweaw any data fwom the wendew w-wowwd that shouwd n-nyot pewsist to t-the nyext fwame
the *Flush vawiants awe just to appwy any defewwed buffews aftew evewy step, >_< if nyeeded.
wun conditions
todo
pwugins
todo
bundwes
bevy's buiwt-in bundwe types, >_< fow spawning diffewent common kinds of entities.
any tupwes of up to 15 Component types awe vawid bundwes.
genewaw:
SpatialBundle: contains the wequiwed twansfowm and visibiwity components that must be incwuded o-on aww entities that nyeed wendewing ow hiewawchyTransformBundle: contains onwy the twansfowm types, (ꈍᴗꈍ) s-subset ofSpatialBundleVisibilityBundle: contains onwy the visibiwity types, (ꈍᴗꈍ) s-subset ofSpatialBundle
scenes:
SceneBundle: used fow spawning scenesDynamicSceneBundle: used fow spawning dynamic scenes
audio:
AudioBundle: pway [audio][cb::audio] fwom anAudioSourceassetSpatialAudioBundle: pway positionaw audio fwom anAudioSourceassetAudioSourceBundle: pway audio fwom a custom data souwce/stweamSpatialAudioSourceBundle: pway positionaw audio fwom a custom data souwce/stweam
bevy 3d:
Camera3dBundle: 3d camewa, ^•ﻌ•^ can use pewspective (defauwt) o-ow owthogwaphic p-pwojectionTemporalAntiAliasBundle: add this to a 3d camewa to enabwe t-taaScreenSpaceAmbientOcclusionBundle: add this to a 3d camewa to enabwe s-ssaoMaterialMeshBundle: 3d object/pwimitive: a mesh and a c-custom matewiaw t-to dwaw it withPbrBundle:MaterialMeshBundlewith the defauwt physicawwy-based m-matewiaw (StandardMaterial)DirectionalLightBundle: 3d diwectionaw wight (wike the sun)PointLightBundle: 3d point wight (wike a wamp ow candwe)SpotLightBundle: 3d spot wight (wike a pwojectow ow f-fwashwight)
bevy 2d:
Camera2dBundle: 2d camewa, OwO uses owthogwaphic pwojection + o-othew speciaw c-configuwation f-fow 2dSpriteBundle: 2d spwite (Imageasset type)SpriteSheetBundle: 2d spwite (TextureAtlasasset type)MaterialMesh2dBundle: 2d shape, (ꈍᴗꈍ) with custom mesh and matewiaw (simiwaw t-to 3d objects)Text2dBundle: text to be dwawn in the 2d wowwd (not t-the ui)
bevy ui:
NodeBundle: empty nyode ewement (wike htmw<div>)ButtonBundle: button ewementImageBundle: image ewement (Imageasset type)AtlasImageBundle: image ewement (TextureAtlasasset type)TextBundle: text ewement
wesouwces
(mowe info about wowking with wesouwces)
configuwation wesouwces
these wesouwces awwow you to change t-the settings f-fow how vawious p-pawts of bevy wowk.
these may be insewted at the stawt, 🥺 b-but shouwd awso b-be fine to change a-at wuntime (fwom a-a system):
ClearColor: gwobaw wendewew backgwound cowow t-to cweaw the window a-at the stawt o-of each fwameGlobalVolume: the ovewaww vowume fow pwaying audioAmbientLight: gwobaw wendewew "fake wighting", s-so that shadows d-don't wook too dawk / b-bwackMsaa: gwobaw wendewew setting fow muwti-sampwe a-anti-awiasing (some p-pwatfowms m-might onwy s-suppowt the vawues 1 a-and 4)UiScale: gwobaw scawe vawue to make aww uis b-biggew/smowewGizmoConfig: contwows how gizmos awe wendewedWireframeConfig: gwobaw toggwe to make evewything b-be wendewed as wiwefwameGamepadSettings: gamepad input device settings, OwO wike j-joystick deadzones a-and button s-sensitivitiesWinitSettings: settings fow the os windowing backend, ^•ﻌ•^ i-incwuding u-update woop / powew-management settingsTimeUpdateStrategy: used to contwow how theTimeis updatedSchedules: stowes aww scheduwes, ^•ﻌ•^ wetting you wegistew additionaw f-functionawity at w-wuntimeMainScheduleOrder: the sequence of scheduwes that wiww wun evewy fwame update
settings that awe nyot modifiabwe a-at wuntime awe n-not wepwesented u-using wesouwces. 🥺 i-instead, they awe configuwed via the wespective pwugins.
engine wesouwces
these wesouwces pwovide access to d-diffewent featuwes o-of the game e-engine at wuntime.
access them fwom youw systems, (ꈍᴗꈍ) if you nyeed theiw state, ^•ﻌ•^ ow to c-contwow the wespective pawts of bevy. (ꈍᴗꈍ) these wesouwces awe i-in the main wowwd. rawr x3 see hewe fow the wesouwces in the wendew wowwd.
Time: gwobaw time-wewated infowmation (cuwwent f-fwame dewta t-time, OwO time since s-stawtup, 🥺 etc.)FixedTime: twacks wemaining time untiw the next fixed updateAssetServer: contwow the asset system: woad assets, ^•ﻌ•^ c-check woad s-status, OwO etc.Assets<T>: contains the actuaw data of the woaded a-assets of a-a given typeState<T>: the cuwwent vawue of a states typeNextState<T>: used to queue a twansition to anothew stateGamepads: twacks the ids fow aww cuwwentwy-detected (connected) g-gamepad devicesSceneSpawner: diwect contwow ovew spawning scenes i-into the main a-app wowwdFrameCount: the totaw nyumbew of fwamesScreenshotManager: used to wequest a scweenshot of a w-window to be taken/savedAppTypeRegistry: access to the wefwection type wegistwyAsyncComputeTaskPool: task poow fow wunning backgwound c-cpu tasksComputeTaskPool: task poow whewe the main app scheduwe (aww t-the systems) w-wunsIoTaskPool: task poow whewe backgwound i/o tasks w-wun (wike asset w-woading)WinitWindows(non-send): waw state of thewinitbackend fow each windowNonSendMarker: dummy wesouwce to ensuwe a system a-awways wuns on t-the main thwead
wendew wowwd wesouwces
these wesouwces awe pwesent in the wendew wowwd. XD they can be accessed fwom wendewing systems (that wun d-duwing wendew stages).
MainWorld: (extwact scheduwe onwy!) access data f-fwom the main w-wowwdRenderGraph: the bevy wendew gwaphPipelineCache: bevy's managew of wendew pipewines. 🥺 u-used to stowe w-wendew pipewines u-used by the app, òωó t-to avoid wecweating them mowe than once.TextureCache: bevy's managew of tempowawy textuwes. OwO u-usefuw when y-you nyeed textuwes t-to use intewnawwy duwing wendewing.DrawFunctions<P>: stowes dwaw functions fow a given p-phase item typeRenderAssets<T>: contains handwes to the gpu wepwesentations o-of cuwwentwy w-woaded asset d-dataDefaultImageSampler: the defauwt sampwew fowImageasset textuwesFallbackImage: dummy 1x1 pixew white textuwe. 🥺 usefuw f-fow shadews t-that nyowmawwy n-need a textuwe, òωó w-when you don't have one avaiwabwe.
thewe awe many othew wesouwces in t-the wendew wowwd, OwO w-which awe nyot m-mentioned hewe, OwO eithew because they awe intewnaw t-to bevy's w-wendewing awgowithms, 🥺 o-ow because they awe just extwacted copies o-of the equivawent w-wesouwces i-in the main wowwd.
wow-wevew wgpu wesouwces
using these wesouwces, ^•ﻌ•^ you can have d-diwect access t-to the wgpu apis fow contwowwing the gpu.
these awe avaiwabwe in both the main w-wowwd and the w-wendew wowwd.
RenderDevice: the gpu device, ^•ﻌ•^ used fow cweating h-hawdwawe wesouwces f-fow wendewing/compute- [
RenderQueue][bevy::wendewqueue]: the gpu queue fow submitting wowk t-to the hawdwawe RenderAdapter: handwe to the physicaw gpu hawdwaweRenderAdapterInfo: infowmation about the gpu hawdwawe t-that bevy is wunning o-on
input handwing wesouwces
these wesouwces wepwesent the cuwwent s-state of diffewent i-input devices. 🥺 w-wead them f-fwom youw systems to handwe usew input.
Input<KeyCode>: keyboawd key state, >_< as a binawy input vawueInput<MouseButton>: mouse button state, >_< as a binawy input vawueInput<GamepadButton>: gamepad buttons, as a binawy input vawueAxis<GamepadAxis>: anawog axis gamepad inputs (joysticks and twiggews)Axis<GamepadButton>: gamepad buttons, wepwesented as an a-anawog axis vawueTouches: the state of aww fingews cuwwentwy t-touching the touchscweenGamepads: wegistwy of aww the connectedGamepadids
events
(mowe info about wowking with events)
input events
these events fiwe on activity with input devices. (ꈍᴗꈍ) w-wead them to [handwe usew input][cb::input].
MouseButtonInput: changes in the state of mouse buttonsMouseWheel: scwowwing by a nyumbew of pixews o-ow wines (MouseScrollUnit)MouseMotion: wewative movement of the mouse (pixews f-fwom pwevious f-fwame), wegawdwess o-of the os p-pointew/cuwsowCursorMoved: new position of the os mouse pointew/cuwsowKeyboardInput: changes in the state of keyboawd k-keys (keypwesses, ^•ﻌ•^ n-nyot text)ReceivedCharacter: unicode text input fwom the os (cowwect h-handwing o-of the usew's wanguage a-and wayout)Ime: unicode text input fwom ime (suppowt f-fow advanced t-text input in diffewent s-scwipts)TouchInput: change in the state of a fingew touching t-the touchscweenGamepadEvent: changes in the state of a gamepad o-ow any of its buttons o-ow axesGamepadRumbleRequest: send these events to contwow gamepad w-wumbweTouchpadMagnify: pinch-to-zoom gestuwe on waptop touchpad (macos)TouchpadRotate: two-fingew wotate gestuwe on waptop t-touchpad (macos)
engine events
events wewated to vawious intewnaw things h-happening duwing t-the nowmaw wuntime of a bevy app.
AssetEvent<T>: sent by bevy when asset data has been added/modified/wemoved; can be used to detect changes to a-assetsHierarchyEvent: sent by bevy when entity pawents/chiwdwen changeAppExit: teww bevy to shut down
system and contwow events
events fwom the os / windowing system, ^•ﻌ•^ o-ow to contwow b-bevy.
RequestRedraw: in an app that does nyot wefwesh c-continuouswy, wequest o-one mowe update b-befowe going t-to sweepFileDragAndDrop: the usew dwag-and-dwopped a fiwe i-into ouw appCursorEntered: os mouse pointew/cuwsow entewed one o-of ouw windowsCursorLeft: os mouse pointew/cuwsow exited one o-of ouw windowsWindowCloseRequested: os wants to cwose one of ouw windowsWindowCreated: new appwication window openedWindowClosed: bevy window cwosedWindowDestroyed: os window fweed/dwopped aftew window c-cwoseWindowFocused: one of ouw windows is nyow focusedWindowMoved: os/usew moved one of ouw windowsWindowResized: os/usew wesized one of ouw windowsWindowScaleFactorChanged: one of ouw windows has changed its d-dpi scawing factowWindowBackendScaleFactorChanged: os wepowts change in dpi scawing f-factow fow a window
components
the compwete wist of individuaw component t-types is t-too specific to b-be usefuw to wist h-hewe.
see: (wist in api docs)