We are getting pretty poor performance in the node editor when the total amounts of nodes reach above ~50.
Looking at the profiler it seems as that the graph is serialized every frame, any specific reason why it needs to do it? Feels like it should only be necessary to serialize the graph is a change has been made to ports, connections or nodes.
The graph IS serialized only when a change is made, except for one occasion, and that is when the graph asset is selected and thus it’s inspector is drawing.
That might sound weird, but the reason behind this, is that Unity force calls the ‘OnBeforeSerialize’ method in every editor frame update when an object’s inspector is shown.
If you deselect the graph (or simply select something else for example), you will notice that the graph will no longer serialize every frame and you will not any longer encounter these performance hits.
Not sure if I misunderstood what you meant but deselecting the asset in did not solve it for me. I checked the profiler and still Serializes the graph every time regardless of what Graph I have opened and what asset I have selected.
I was mistaken, but still some weird behaviour. It seems as if a graph will be serialized if I have it selected as you said, but it does not have to be opened. If I selected an empty graph and had my heavy graph opened, serialization did not happen every frame, but if I selected a different graph that also had a lot of nodes in it, serialization happened every frame.
Sorry for late reply.
Yes, it does not matter which graph is open for editing. The only thing that matters (as far as the continous serialization), is which graph asset is selected in the project for inspection.
Once again, the fact that Serialization callback is called every frame when an object is selected, is a Unity thing which I don’t know why they decide to do it.
The workaround is simply, to not have a graph asset object selected. You can still of course have the graph open in the node editor to edit as you desire.