Migration Guide: v0.8 to v0.9
This guide covers breaking changes and new features when upgrading from godot-bevy 0.9.x to 0.10.0.
Table of Contents
NodeTreeView::from_node now returns a Result type (Breaking Change)
What Changed
NodeTreeView::from_node derive macro now returns a Result<Self, NodeTreeViewError> type to avoid surprise panic in
user code if a godot node is not found.
Migration Path
Use match, if let or unwrap to handle the Result type returned by NodeTreeView::from_node.
Before (v.0.10.0)
let mut mob_nodes = MobNodes::from_node(mob);
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| MenuUi::from_node(root))) {
Ok(menu_ui) => {
info!("MainMenu: Successfully found menu nodes");
}
Err(_) => {
debug!("MainMenu: Menu nodes not ready yet, will retry next frame");
}
}
After (v.0.10.0)
let mut mob_nodes = MobNodes::from_node(mob).unwrap();
match MenuUi::from_node(root) {
Ok(menu_ui) => {
info!("MainMenu: Successfully found menu nodes");
}
Err(_) => {
debug!("MainMenu: Menu nodes not ready yet, will retry next frame");
}
}
Breaking changes
Return type of NodeTreeView::from_node derive macro changed from Self to Result<Self, NodeTreeViewError>.
Migration Checklist
-
Use
match,if letorunwrapto handle theResulttype returned byNodeTreeView::from_node.