Skip to content

How to Type returning a System from a function without typing all parameters (i.e a "System" type?) #19271

Answered by hymm
Joel-Singh asked this question in Q&A
Discussion options

You must be logged in to vote

if you're trying to insert the system into a schedule you can do this:

fn set_message(message: String) -> ScheduleConfigs<ScheduleSystem> {
    return (move |mut commands: Commands, message_box: Query<Entity, With<Ray>>| {
        commands
            .entity(message_box.single().unwrap())
            .insert(Text::new(message.clone()));
    })
    .into_configs();
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Joel-Singh
Comment options

Answer selected by Joel-Singh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants