mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
bb968f41bc
# Objective Entities are unique, however, this is not reflected in the scene format. Currently, entities are stored in a list where a user could inadvertently create a duplicate of the same entity. ## Solution Switch from the list representation to a map representation for entities. --- ## Changelog * The `entities` field in the scene format is now a map of entity ID to entity data ## Migration Guide The scene format now stores its collection of entities in a map rather than a list: ```rust // OLD ( entities: [ ( entity: 12, components: { "bevy_transform::components::transform::Transform": ( translation: ( x: 0.0, y: 0.0, z: 0.0 ), rotation: (0.0, 0.0, 0.0, 1.0), scale: ( x: 1.0, y: 1.0, z: 1.0 ), ), }, ), ], ) // NEW ( entities: { 12: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( x: 0.0, y: 0.0, z: 0.0 ), rotation: (0.0, 0.0, 0.0, 1.0), scale: ( x: 1.0, y: 1.0, z: 1.0 ), ), }, ), }, ) ```
36 lines
639 B
Text
36 lines
639 B
Text
(
|
|
entities: {
|
|
0: (
|
|
components: {
|
|
"bevy_transform::components::transform::Transform": (
|
|
translation: (
|
|
x: 0.0,
|
|
y: 0.0,
|
|
z: 0.0
|
|
),
|
|
rotation: (0.0, 0.0, 0.0, 1.0),
|
|
scale: (
|
|
x: 1.0,
|
|
y: 1.0,
|
|
z: 1.0
|
|
),
|
|
),
|
|
"scene::ComponentB": (
|
|
value: "hello",
|
|
),
|
|
"scene::ComponentA": (
|
|
x: 1.0,
|
|
y: 2.0,
|
|
),
|
|
},
|
|
),
|
|
1: (
|
|
components: {
|
|
"scene::ComponentA": (
|
|
x: 3.0,
|
|
y: 4.0,
|
|
),
|
|
},
|
|
),
|
|
}
|
|
)
|