Hello there and thank you for your positive feedback.
Please note that the things that take place within the if ( newSerialization != _serializedGraph || !newReferences.SequenceEqual(_objectReferences) ) { clause, are not related to the graph being serialized or not. The graph is already serialized (exactly one line above that) var newSerialization = this.Serialize(newReferences); anyways before that clause.
With that said, what you stated can indeed happen in some cases, although it is not always the case and while trying to replicate this it only occurred in one graph out of all I have in the project; still looking out as of why it happens on that one specific graph. However, once again, please note that graph serialization takes place regardless of the SequenceEquals check.
For your information regarding the code, as explained in the comments above, we add null to the first element of the list because we are not serializing default values. Since UnityObject serialization is happening with integers representing indeces, if 0 was the representation of an object we actually do want to serialize, it would not happen because 0 is naturally the default value of integer and as such that object serialization would be lost since no entry would be added for that element in the json. There are of course other ways to handle this, but at the time it seemed a straightforward one (and kept that way ever since for backwards compatibility).
With all that said, I will take a look at this and find out why it only reproduces on one specific graph I have out of all and then handle this UnityObject intricacy somehow for consistency. (graph serialization would still take place regardless though before that check 🙂 )
Let me know.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.