Tri-Inspector Performance in Editor #198
Unanswered
ininsicken
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently began implementing Tri-Inspector attributes heavily into a complex character controller script I have. It uses partial classes to split up the logic, but of course, all the serialized fields are shown in the inspector. Now, I am someone who loves to customize every little detail and having a lot of the variables serialized in the inspector makes it much easier to test and tweak to get the right movement variables (I also want it to be a more universally usable script in case I need it for future projects).
My problem comes with having this script open in the inspector while running the game. I noticed crazy stutters/lag spikes for a solid 3-4 seconds after starting the game in the editor. After that, it completely smooths out and runs at a stable 220-250 fps like it normally does. This only happens with the character controller script that heavily utilizes Tri-Inspector attributes. I don't have an ABSURD amount of serialized/public variables, it's around ~70-80, and a hefty amount of Tri-Inspector attributes; 2 box groups, 9 tabs, ~18 title, ~6 required, ~20 enable/disable if, ~16 readonly attributes.
Here is the profiler showing what happens when I have the inspector open and start running the game:
It seems to only happen after I make a change within any script and reload the project, then try to run the game. It also seems to only happen the first time I run the game (maybe 2-3 times on occasion if I change the character controller script).
The vast majority of the time in the profile comes from EditorLoop and PlayerLoop/UpdateScene. Sometimes EditorLoop will take 99%+ of the profiler times and other times it will be split between EditorLoop and one of various different calls inside PlayerLoop/UpdateScene.
Confirmed that this ONLY occurs on the script that uses Tri-Inspector and it does not happen when running the same script without any Tri-Inspector attributes in it. Though there is still some small hitches from EditorLoop likely due to so many serialized variables, it's nowhere near as bad as with Tri-Inspector; maybe spikes to 80-100 fps with only one or two spikes; with Tri-Editor it spikes anywhere from 10-50 fps with anywhere from 3-10+ spikes.
Using Tri-Inspector is absolutely necessary for how many variables I have in this script since without some nesting and organization, it would be a disaster to look through, but the performance hitches get annoying. Do some attributes hit performance harder in the editor or do I just have too many serialized fields that have to be drawn in the editor with all the attributes that is causing the spikes?
Beta Was this translation helpful? Give feedback.
All reactions