Persisting Large ScriptableObject Causes Lag


I have a custom editor extension that saves data to a ScriptableObject. This scriptable object has about 10 fields to store the data, which are all lists of either ints, strings, or bytes. I was initially having a problem where Unity would hang temporary as it was saving this data but I solved that by saving the data in a separate thread. Now the problem is when I set the ScriptableObject dirty via EditorUtility.SetDirty, Unity hangs for a second or two as I am assuming it is persisting the changes.

The lists are relatively large, for example the byte list has 8570 bytes. But you wouldn’t think 8.5 kb would take any time at all to save. That is the largest array - others have 1500 elements max. If I don’t call EditorUtility.SetDirty then the changes are instant, but of course that would lead to other problems of the data not actually being saved.

Does anybody have any ideas on how I can speed this up?


Hey Champ,

I got 2 Ideas.

  • How about a save Button?
  • how about splitting up the Asset into many Components, one for every list, and then saving only the list that changed? (You can try to combine them later, but don’t ask me how^^)