public bool LoadScene(string path) { var result = true; try { var data = Serializr.Deserialize(path, typeof(SerializedScene)); var serializedScene = data as SerializedScene; if (serializedScene != null) { NewScene(); foreach (var mat in serializedScene.Materials) { _scene.Add(mat); } foreach (var so in serializedScene.SceneObjects) { so.PostDeserialize(); _scene.Add(so); } _scene.RenderSettings.Set(serializedScene.RenderSettings); } } catch (Exception ex) { Debug.Log(ex.Message); result = false; } return(result); }
public bool SaveScene(string path) { var result = true; try { var serScene = new SerializedScene() { Materials = _scene.GetUsedMaterials(), SceneObjects = _scene.GetUsedSceneObjects(), RenderSettings = _scene.RenderSettings }; Serializr.Serialize(path, serScene); } catch (Exception ex) { result = false; Debug.Log(ex.Message); } return(result); }