Skip to content
This repository was archived by the owner on Dec 5, 2018. It is now read-only.

Commit 4414079

Browse files
committed
upgraded to SpatialOS 12.0.4
1 parent 66affa2 commit 4414079

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

snapshots/default.snapshot

0 Bytes
Binary file not shown.

workers/unity/Assets/Editor/SnapshotMenu.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using UnityEditor;
88
using 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
}

0 commit comments

Comments
 (0)