In this in-depth talk we'll cover entity serialization to and from disk, how we built seamless play mode streaming and efficient editor workflow, and what a separate ECS world can do for you.
Fabrice Lété (Unity Technologies), Simon Mogensen (Unity Technologies)
8. 8
1. Convert GameObjects to Entities
via ComponentDataWrapper or custom code.
2. No Conversion
not everything can be ECS yet.GameObjects
GameObjects Entities / Components
EditorWorkflow Overview
9. 9
GameObjects
GameObjects Entities / Components
1. Asynchronous Loading
to a Staging ECS World
2. Merge
via MoveEntities
SubsceneMain Scene Entities / Components
EditorDisk
Save
Load
Merge
Workflow Overview
10. 10
GameObjects
GameObjects Entities / Components
SubsceneMain Scene Entities / Components
Entities / ComponentsGameObjects
Save
Load
Merge
Merge
EditorDiskGame
20. Classic Unity File Format
20
File Formats
Shared Components
SomeBuilding_shared.prefabSomeBuilding.scene
GameObject Scene
SomeBuilding_header.asset
Meta Data
Editor Only Editor and Game
21. Classic Unity File Format
ECS Specific File Format
21
File Formats
Shared Components
SomeBuilding_shared.prefabSomeBuilding.scene
GameObject Scene
SomeBuilding.entities
Types / Archetypes / Chunks
SomeBuilding_header.asset
Meta Data
Editor Only Editor and Game
25. 25
Staging Worlds
Main World Staging WorldStaging World Staging World
Load Shared
Components
Load Entities
Load Request
Async Async
26. 26
Staging Worlds
Main World Staging WorldStaging World Staging World
Load Shared
Components
Load Entities
Load Request
Async Async
ECS Data
Deserialize
27. 27
Staging Worlds
Main World Staging WorldStaging World Staging World
Load Shared
Components
Load Entities
Load Request
Async Async
ECS Data
Move Deserialize
- Move leaves the staging world empty.
33. Moving Entities into the main world
33
● Allocate Entity ids
● Remap Entity ids in chunks
34. 34
Allocating entity ids
1 1 1 1
A
2
1
C
1
1
C
4
1
A
1
1
C
0
1
A
3
1
C
3
1
C
2
1
B
2
Index
A
0
0
B
1
1
B
0
2 3 4 5 6 7 8 9 10 11
Version
Chunk
Index in Chunk
35. Allocating entity ids
35
Version
Chunk
Index in Chunk
1
A
2
1
-
4
1
C
4
1
A
1
1
-
9
1
A
3
1
C
3
1
-
1
1
B
2
1
-
10
1
-
11
1
-
-1
Index 0 1 2 3 4 5 6 7 8 9 10 11
First free index