File tree 1 file changed +18
-10
lines changed
1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ pub use margins::*;
18
18
pub use render:: * ;
19
19
pub use ui_node:: * ;
20
20
21
+ use bevy_render:: RenderPlugin ;
22
+
21
23
#[ doc( hidden) ]
22
24
pub mod prelude {
23
25
#[ doc( hidden) ]
@@ -76,15 +78,7 @@ impl Plugin for UiPlugin {
76
78
CoreStage :: PreUpdate ,
77
79
ui_focus_system. label ( UiSystem :: Focus ) . after ( InputSystem ) ,
78
80
)
79
- // add these stages to front because these must run before transform update systems
80
- . add_system_to_stage (
81
- CoreStage :: PostUpdate ,
82
- widget:: text_system. before ( UiSystem :: Flex ) ,
83
- )
84
- . add_system_to_stage (
85
- CoreStage :: PostUpdate ,
86
- widget:: image_node_system. before ( UiSystem :: Flex ) ,
87
- )
81
+ // Add these stages to front because these must run before transform update systems
88
82
. add_system_to_stage (
89
83
CoreStage :: PostUpdate ,
90
84
flex_node_system
@@ -102,6 +96,20 @@ impl Plugin for UiPlugin {
102
96
update_clipping_system. after ( TransformSystem :: TransformPropagate ) ,
103
97
) ;
104
98
105
- crate :: render:: build_ui_render ( app) ;
99
+ // Allows for UIPlugin to be tested without a renderer
100
+ // (text_system and image_node_system depend on textures, which are only
101
+ // available with RenderPlugin)
102
+ if app. is_plugin_added :: < RenderPlugin > ( ) {
103
+ app. add_system_to_stage (
104
+ CoreStage :: PostUpdate ,
105
+ widget:: text_system. before ( UiSystem :: Flex ) ,
106
+ )
107
+ . add_system_to_stage (
108
+ CoreStage :: PostUpdate ,
109
+ widget:: image_node_system. before ( UiSystem :: Flex ) ,
110
+ ) ;
111
+
112
+ crate :: render:: build_ui_render ( app) ;
113
+ }
106
114
}
107
115
}
You can’t perform that action at this time.
0 commit comments