- Home /
scriptable objects slow down the editor
We have an issue with scriptable objects slowing down the editor massively. They are only used as data containers and as such has no actual logic in them. The thing is that the c# script doesn't cause any issues, it's only the instances of the scribtable objects that does. If we delete all instances (Roughly 80), the editor runs fine again.
The slow downs that it causes: Without the scriptable objects, the compile time is 20 seconds, with them it is 50 seconds. They add consistentlty 30 seconds of compile time. (This is not the main issue). Without the scriptable objects, unity is rather responsive, with the scriptable object whenever unity loses focus and regains it, it is frozen for 6-10 seconds. This is the main issue. I'm a little uncertain if the scriptable objects causes it or if the compile time does.
Does anyone know why this might happen?
Answer by yetyman · Jul 19, 2019 at 11:11 PM
hello,
A bit of a late reply, but you said it slows down the editor, do you mean it slows down usage of the editor or that it slows down debugging?
if it slows down debugging on start, that's because all of the Scriptable objects need to be read in from the harddrive. if i have my facts straight on Scriptable Objects, one of the big features is that they automatically handle serializing and saving themselves. that means they exist in some way as files on the harddrive. Accessing them for the first time will require harddrive reading.
if its used in say... a gizmo, that will be more severe as i believe unity will attempt to read the scriptable object from the harddrive each time it tries to access it while the game isnt playing. to fix this, you can cache the scriptable object in your gizmo class and it should stay in memory.
That makes a lot of sense. Thanks for the explanation! It is just a shame, we are using a bunch of different scriptable objects as well and it is frustrating having to wait an extra 30sec everytime you swap in that scene or that folder it really slows down dev time.
Your answer

Follow this Question
Related Questions
Ability System with ScriptableObject 1 Answer
Scriptable Object only useable from code, not via inspector 1 Answer
Why do I need to serialize a struct inside a ScriptableObject to save its data? 1 Answer
Make the same serialized class as a ScriptableObject? 1 Answer
How To Freeze An Object Motion? 3 Answers