Fix C# serialization of scene objects when property throws and exception

#88
This commit is contained in:
Wojtek Figat
2023-05-06 14:57:44 +02:00
parent 3f2f567364
commit 2affebd375
2 changed files with 85 additions and 44 deletions

View File

@@ -37,7 +37,7 @@ namespace FlaxEngine.Json
{
// Skip serialization as reference id for the root object serialization (eg. Script)
var cache = JsonSerializer.Current.Value;
if (cache != null && cache.IsDuringSerialization && cache.SerializerWriter.SerializeStackSize == 0)
if (cache != null && cache.IsWriting && cache.SerializerWriter.SerializeStackSize == 0)
{
return false;
}