I'm trying to make a helper function for spawning ui that takes in a &mut ChildBuilder and returns an EntityCommands so that i can use it to add other components. here's the important part of the code:
fn button<'a>(parent: &'a mut ChildBuilder<'a>, ...) -> EntityCommands<'a> {
...
let mut entity_commands = parent.spawn(ButtonBundle {
...
});
...
entity_commands
}
this itself compiles but when i try to call it, i get the error that "1 must outlive 2". anyone know what's going on?