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

Updated SnapshotMenu to use new Streaming API #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions workers/unity/Assets/Editor/SnapshotMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using UnityEditor;
using UnityEngine;

namespace Assets.Editor
namespace Assets.Editor
{
public class SnapshotMenu : MonoBehaviour
{
Expand All @@ -26,15 +26,18 @@ private static void GenerateDefaultSnapshot()
private static void SaveSnapshot(IDictionary<EntityId, Entity> snapshotEntities)
{
File.Delete(SimulationSettings.DefaultSnapshotPath);
var maybeError = Snapshot.Save(SimulationSettings.DefaultSnapshotPath, snapshotEntities);

if (maybeError.HasValue)
using (SnapshotOutputStream stream = new SnapshotOutputStream (SimulationSettings.DefaultSnapshotPath))
{
Debug.LogErrorFormat("Failed to generate initial world snapshot: {0}", maybeError.Value);
}
else
{
Debug.LogFormat("Successfully generated initial world snapshot at {0}", SimulationSettings.DefaultSnapshotPath);
foreach (var pair in snapshotEntities)
{
var error = stream.WriteEntity (pair.Key, pair.Value);
if (error.HasValue)
{
Debug.LogErrorFormat("Failed to generate initial world snapshot: {0}", error.Value);
return;
}
}
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions workers/unity/Assets/EntityPrefabs/Cube.prefab.meta

This file was deleted.

8 changes: 0 additions & 8 deletions workers/unity/Assets/EntityPrefabs/Player.prefab.meta

This file was deleted.

8 changes: 0 additions & 8 deletions workers/unity/Assets/EntityPrefabs/PlayerCreator.prefab.meta

This file was deleted.

9 changes: 0 additions & 9 deletions workers/unity/Assets/Resources/EntityPrefabs.meta

This file was deleted.

Loading