Using EditorOnly mode for Odin. ScriptableObject instance (BrainProfileScorePercentilesSO), with a list of ~1500 objects, each object having 5 simple properties (int, float, string). BrainProfileScorePercentilesSO properties are decorated with odin attributes, child objects are likewise. Both BrainProfileScorePercentilesSO and child objects have odin validator functions attached to one or more properties.
When selecting a scriptable object asset/instance in the project view, the inspector draws the object. When drawing the object using odin attributes, the editor lags tremendously. When profiling it seems to all originate from OdinEditor.OnInspectorGUI(), which is overridden in a custom editor for the scriptable object type, however the original logic is kept by calling base.OnInspectorGUI(). Seems to take roughly 300ms per frame when the inspector has to draw, regardless if list is collapsed or expanded. When deep profiling the editor it takes 4000+ ms per frame, with some deep calls inside PropertyTree reaching 60000+ calls!
Fun fact: Saved the Unity Profiler session to a file.. the saved data file is 2.34 GB!?
How can we reproduce it?
I dont have a repro-project, but i believe this isnt super specific to our project.
1) Create a list of objects with 5 simple properties each, and populate the list with ~1500 objects with random values.
2) Observe that the editor lags when scrolling or otherwise interacting with the inspector, as Unity issues draw calls to the odin editor.
If screenshots would help explain or demonstrate your issue, please include these.
Profiler Screenshot 1 (Profile Editor + Deep Profile): List collapsed
Profiler Screenshot 2 (Profile Editor): List collapsed
Profiler Screenshot 3 (Profile Editor): List expanded (15 items per page)
I have also attached some code snippets (i cannot share the code in its entirety, sorry!) if these would help to see if i did anything wrong/stupid in my usage of the Odin inspector framework.
What version of Unity are you using?
What version of Odin are you using? (See "Tools > Odin Inspector > About")
Odin Inspector version: 22.214.171.124
Editor Only Mode: Enabled
What operating system are you on?
OS: Windows 10
CPU: Intel Core i5-6600 (3.3 GHz)
RAM: 8 GB