#Spawn a light bundle without the light

1 messages · Page 1 of 1 (latest)

copper escarp
#

Current

match light.kind {
    LightKind::Point => commands.spawn(PointLightBundle {
        transform,
        point_light: PointLight {
            color: Color::from(light.color),
            // intensity: (),
            ..Default::default()
        },
        ..Default::default()
    }),
    LightKind::Spot => commands.spawn(SpotLightBundle {
        transform,
        spot_light: SpotLight {
            color: Color::from(light.color),
            ..Default::default()
        },
        ..Default::default()
    }),
};
#

What I want

let light = match light.kind {
    LightKind::Point => PointLight {
        color: Color::from(light.color),
        ..Default::default()
    },
    LightKind::Spot => SpotLight {
        color: Color::from(light.color),
        ..Default::default()
    },
}

commands.spawn((
    LightBundle {
        transform,
        ..Default::default()
    },
    light,
)