Fix C# objects serialization bug when script throws exception during saving to Json
#1656
This commit is contained in:
@@ -1218,10 +1218,9 @@ bool LevelImpl::saveScene(Scene* scene, rapidjson_flax::StringBuffer& outBuffer,
|
||||
// Json resource data
|
||||
writer.JKEY("Data");
|
||||
writer.StartArray();
|
||||
SceneObject** objects = allObjects.Get();
|
||||
for (int32 i = 0; i < allObjects.Count(); i++)
|
||||
{
|
||||
writer.SceneObject(allObjects[i]);
|
||||
}
|
||||
writer.SceneObject(objects[i]);
|
||||
writer.EndArray();
|
||||
}
|
||||
writer.EndObject();
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace FlaxEngine.Json
|
||||
if (IsWriting)
|
||||
{
|
||||
// Reset writing state (eg if previous serialization got exception)
|
||||
SerializerWriter = new JsonSerializerInternalWriter(JsonSerializer);
|
||||
JsonWriter = new JsonTextWriter(StringWriter)
|
||||
{
|
||||
IndentChar = '\t',
|
||||
|
||||
Reference in New Issue
Block a user