Skip to content

Commit

Permalink
Log an error message if loading a star database fails
Browse files Browse the repository at this point in the history
  • Loading branch information
StollD committed Aug 12, 2018
1 parent 40718f3 commit 7640795
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Unity Project/IC Viewer/Assets/Scripts/EditorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,23 @@ public void Update()

public void LoadBodies(String json)
{
Body.DestroyAllBodies();
Body.bodies.Clear();
try
{
Body.DestroyAllBodies();
Body.bodies.Clear();

BodyList bl = JSONLoader.LoadStars(json);
DataBody.LoadBodiesInGame(bl);
BodyList bl = JSONLoader.LoadStars(json);
DataBody.LoadBodiesInGame(bl);

GameObject tempParentGo = GameObject.Find("Bodies");
foreach (GameObject go in Body.bodies)
GameObject tempParentGo = GameObject.Find("Bodies");
foreach (GameObject go in Body.bodies)
{
go.transform.SetParent(tempParentGo.transform);
}
}
catch (Exception e)
{
go.transform.SetParent(tempParentGo.transform);
Logger.Error("Exception while loading: " + e);
}
}

Expand Down

0 comments on commit 7640795

Please sign in to comment.