This repository was archived by the owner on Dec 5, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
workers/unity/Assets/Editor Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 77using UnityEditor ;
88using UnityEngine ;
99
10- namespace Assets . Editor
10+ namespace Assets . Editor
1111{
1212 public class SnapshotMenu : MonoBehaviour
1313 {
@@ -25,16 +25,20 @@ private static void GenerateDefaultSnapshot()
2525 private static void SaveSnapshot ( IDictionary < EntityId , Entity > snapshotEntities )
2626 {
2727 File . Delete ( SimulationSettings . DefaultSnapshotPath ) ;
28- var maybeError = Snapshot . Save ( SimulationSettings . DefaultSnapshotPath , snapshotEntities ) ;
29-
30- if ( maybeError . HasValue )
31- {
32- Debug . LogErrorFormat ( "Failed to generate initial world snapshot: {0}" , maybeError . Value ) ;
33- }
34- else
28+ using ( SnapshotOutputStream stream = new SnapshotOutputStream ( SimulationSettings . DefaultSnapshotPath ) )
3529 {
36- Debug . LogFormat ( "Successfully generated initial world snapshot at {0}" , SimulationSettings . DefaultSnapshotPath ) ;
30+ foreach ( var kvp in snapshotEntities )
31+ {
32+ var error = stream . WriteEntity ( kvp . Key , kvp . Value ) ;
33+ if ( error . HasValue )
34+ {
35+ Debug . LogErrorFormat ( "Failed to generate initial world snapshot: {0}" , error . Value ) ;
36+ return ;
37+ }
38+ }
3739 }
40+
41+ Debug . LogFormat ( "Successfully generated initial world snapshot at {0}" , SimulationSettings . DefaultSnapshotPath ) ;
3842 }
3943 }
4044}
You can’t perform that action at this time.
0 commit comments