You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use NaughtyAttributes for Small Repos and for Complex projects, I use Odin. I avoid Odin since it is too much for small projects.
Now I am using NaughtyAttributes for a class with around 25-30 variables serialized in Inspector. There are few sliders and few headers. I am using 2019.3.3. Now since I upgraded from 2019.2 to 2019.3 the editor lags severally if I select this object in scene which has this class with many exposed variables. To confirm the issue I removed NaughtyAttributes using in the class and commented the Attributes and speed is increased. I switched to Odin to avoid this lag and in Odin there is no lag and has natural speed.
I checked profiler when using NaughtyAttributes and is shows EditorLoop as 80% which is huge. To playtest I have to use Maximize On Play to avoid editor lag.
I am pretty sure that NaughtyAttributes is doing some stuff which is making Unity editor so laggy. I think I have never encountered such issues when using NA earlier and I think it has something to do with newer NA v.2.0+ paired with 2019.3 and a variable heavy class.
I hope you fix it soon.
Thank you
Reacted by Denis Rizov, Luke Seers, Manh Hieu, Marcel Wiessler, Chanchana Sornsoontorn, Luke Mirman, nzeman, Mayke Rodrigues (Mike), Finnbarr O'Callahan and NeatWolf
I have a similar case in a project where everything is becoming extremely unresponsive. Looked into the profiler and noticed a couple of naughty attribute calls seemly causing a big junk of it... (been on 2019.3.13 and updated to 19.3.15 today)
@marwie I was looking at this issue my self today and trying to find simple workaround in the editor. It seems there are many calls to fx ReflectionUtility.GetAttribute which in some cases (at least for ShowIfAttribute) are not needed and can be kept and then reused in the call. I also looked into creating delegates for the calls since they do not change between conditionName setting on the attribute. This sped things up. Some of the garbage collection seems to come from Unity propertdrawing itself, I have yet to look deeper into that
just wanted to say that I'm also testing NaughtyAttributes (v2 branch) on Unity 2019.4.2f1 (LTS) and experiencing severe slowdowns when using ShowIf+BoxAttribute
BTW: I'd gladly pay for having full support on the Unity Asset Store - I wanted to use ODIN while working in my company, but apparently it costs 250 bucks - per seat - and there's only me actually accessing it!
Any chance of using some caching system to speed up the rendering?
just wanted to say that I'm also testing NaughtyAttributes (v2 branch) on Unity 2019.4.2f1 (LTS) and experiencing severe slowdowns when using ShowIf+BoxAttribute
BTW: I'd gladly pay for having full support on the Unity Asset Store - I wanted to use ODIN while working in my company, but apparently it costs 250 bucks - per seat - and there's only me actually accessing it!
Any chance of using some caching system to speed up the rendering?
Hey mate, I am doing my best to update as frequently as I can. I'm pretty busy the last couple of months, and I am trying to chill in my free time. I am trying to address and fix the issues that people report every month or two. I have it planned to look at the slow down for the next release. Fortunately, the issue is related to the conditional attributes mostly (ShowIf, EnableIf), so it might not be that hard to fix. I have to cache things, because the reflection is heavy there.
Confirm still happening. I have this issue also. It makes the game lag if I select the component with naughty attributes in the inspector. It seems any attribute causes this issue. For example if I enable InputAxis attribute then it will cause all fields to be laggy. Try typing random number in an int field and you will see the lag, the typed characters will slowly show up.
@snorrsi No, I haven't done anything about this, it's not a priority at the moment. However, I tested some months ago with the current Unity version and with 2018.3. With 2018.3 there are no performance issues. The new UI system is heavier than the previous one, and the Unity docs state that the new UI Elements system is more optimized.
Hey folks,
I encountered similar issues and found a performance improvement!
If you have a unity object with lots and lots of fields which can happen for settings files, the perf drops pretty fast.
The main issue is getting attributes (expensive Reflection) per property on every on inspector gui call, aswell as fetching every serialized property in this call.
Ill create a fork and test around a bit but the idea is to fetch all the required stuff after compilation (OnEnable) and not on every call and refactor the methods, that fetched the attributes like "IsVisible" and "IsEnabled" etc.
Its still not perfect and not every case is covered (since I was focusing on mine) and testing + refactoring needs to be done but thats a huge boost on my machine!
The downside to it is, that it caches all scripts in unity after compiling. I think a better attempt is to cache them on the current opened inspector and cleanup after leave...
Activity
dbrizov commentedon Mar 4, 2020
Thanks, I'll look into it.
snorrsi commentedon Mar 18, 2020
@dbrizov have you gotten to look into that issue ?
dbrizov commentedon Mar 19, 2020
I haven't
lmichaudel commentedon Apr 26, 2020
Hi, same problem here, but it only happen with BoxGroups
marwie commentedon Jun 3, 2020
I have a similar case in a project where everything is becoming extremely unresponsive. Looked into the profiler and noticed a couple of naughty attribute calls seemly causing a big junk of it... (been on 2019.3.13 and updated to 19.3.15 today)
marwie commentedon Jun 3, 2020
Here's a screenshot using deep profiling with stack trace. I only clicked on an element in the scene hierarchy here.
snorrsi commentedon Jun 3, 2020
@marwie I was looking at this issue my self today and trying to find simple workaround in the editor. It seems there are many calls to fx ReflectionUtility.GetAttribute which in some cases (at least for ShowIfAttribute) are not needed and can be kept and then reused in the call. I also looked into creating delegates for the calls since they do not change between conditionName setting on the attribute. This sped things up. Some of the garbage collection seems to come from Unity propertdrawing itself, I have yet to look deeper into that
NeatWolf commentedon Jul 3, 2020
Hey,
just wanted to say that I'm also testing NaughtyAttributes (v2 branch) on Unity 2019.4.2f1 (LTS) and experiencing severe slowdowns when using ShowIf+BoxAttribute
BTW: I'd gladly pay for having full support on the Unity Asset Store - I wanted to use ODIN while working in my company, but apparently it costs 250 bucks - per seat - and there's only me actually accessing it!
Any chance of using some caching system to speed up the rendering?
dbrizov commentedon Jul 3, 2020
Hey mate, I am doing my best to update as frequently as I can. I'm pretty busy the last couple of months, and I am trying to chill in my free time. I am trying to address and fix the issues that people report every month or two. I have it planned to look at the slow down for the next release. Fortunately, the issue is related to the conditional attributes mostly (ShowIf, EnableIf), so it might not be that hard to fix. I have to cache things, because the reflection is heavy there.
dbrizov commentedon Aug 12, 2020
Also check ReadOnly attribute
offchan42 commentedon Sep 22, 2020
Confirm still happening. I have this issue also. It makes the game lag if I select the component with naughty attributes in the inspector. It seems any attribute causes this issue. For example if I enable
InputAxisattribute then it will cause all fields to be laggy. Try typing random number in an int field and you will see the lag, the typed characters will slowly show up.snorrsi commentedon Jan 12, 2021
@dbrizov any update?
dbrizov commentedon Jan 12, 2021
@snorrsi No, I haven't done anything about this, it's not a priority at the moment. However, I tested some months ago with the current Unity version and with 2018.3. With 2018.3 there are no performance issues. The new UI system is heavier than the previous one, and the Unity docs state that the new UI Elements system is more optimized.
nikodemgrz commentedon Sep 6, 2021
@snorrsi
@dbrizov
@marwie
@NeatWolf
@off99555
Hey folks,
I encountered similar issues and found a performance improvement!
If you have a unity object with lots and lots of fields which can happen for settings files, the perf drops pretty fast.
The main issue is getting attributes (expensive Reflection) per property on every on inspector gui call, aswell as fetching every serialized property in this call.
Ill create a fork and test around a bit but the idea is to fetch all the required stuff after compilation (OnEnable) and not on every call and refactor the methods, that fetched the attributes like "IsVisible" and "IsEnabled" etc.

Its still not perfect and not every case is covered (since I was focusing on mine) and testing + refactoring needs to be done but thats a huge boost on my machine!
So lets see how it goes...
nikodemgrz commentedon Sep 6, 2021
Here is the result of my current attempts at:
https://github.com/niggo1243/NaughtyAttributes/tree/issue/%23133-inspector-lag
Old Issue:
Fix:
The downside to it is, that it caches all scripts in unity after compiling. I think a better attempt is to cache them on the current opened inspector and cleanup after leave...
dbrizov#133 fixed expandable attr causing null ref exceptions
dbrizov#133 some refactorings in the naming
dbrizov#133 another small boost
dbrizov#133 memory cleanup refactoring and notes/ ideas to potentiall…
dbrizov#133 GetLabel Attribute caching
dbrizov#133 caching isVisible, isEnabled and special drawers
dbrizov#133 waaay faster now
nikodemgrz commentedon Sep 10, 2021
Update:

vs Initial issue:

Merge branch 'issue/dbrizov#133-inspector-lag'
dbrizov commentedon Nov 8, 2021
There is a pull request that caches a lot of things to minimize runtime reflection.
#264
snorrsi commentedon Dec 3, 2021
@dbrizov why is this closed if the pull hasn't been merged? .. Are you planning on merging that pull request at some time ?
imniko commentedon Feb 7, 2023
bump