Fix null values handling in C# Json serialization

It didn't replace prefab object reference if replaced with null in the prefab instance.
This commit is contained in:
Wojtek Figat
2021-08-19 13:03:54 +02:00
parent 4c1dbb7f8e
commit a8c7705c3b
3 changed files with 11 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ namespace FlaxEngine.Json
ContractResolver = new ExtendedDefaultContractResolver(isManagedOnly),
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
TypeNameHandling = TypeNameHandling.Auto,
NullValueHandling = NullValueHandling.Ignore,
NullValueHandling = NullValueHandling.Include,
ObjectCreationHandling = ObjectCreationHandling.Auto,
};
if (ObjectConverter == null)
@@ -276,6 +276,11 @@ namespace FlaxEngine.Json
cache.IsDuringSerialization = false;
Current.Value = cache;
/*// Debug json string reading
cache.MemoryStream.Initialize(jsonBuffer, jsonLength);
cache.Reader.DiscardBufferedData();
string json = cache.Reader.ReadToEnd();*/
cache.MemoryStream.Initialize(jsonBuffer, jsonLength);
cache.Reader.DiscardBufferedData();
var jsonReader = new JsonTextReader(cache.Reader);