Hi,
I have an issue in the editor.
In my project, I have a lot of scripts (like 5 base class with ten / thousand of subclasses for each)… To identify them easily, I added icons to each “family”.
In the scene view, performance are somewhat ok. But when I start play mode and go back to scene view, I am under 10 or 5 fps which is really annoying.
I noticed that if I disable gizmos in scene view this way :
Performances are back to normal.
So I have several questions :
-Almost none of them have OnDrawGizmo so why does it propose to me to enable or disable gizmo ?
-Why is there a difference between play mode On and Off (even if the two windows aren’t displayed simultaneously)
-Is the large amount of scripts responsible of my performance hit ?
-If so, is there a way to prevent my script with custom icons to be added to the gizmos window ?
-In last resort I can’t find a way to programatically toggle the button. I found a way online by using reflection and Editor function :
Assembly asm = Assembly.GetAssembly(typeof(Editor));
Type type = asm.GetType("UnityEditor.AnnotationUtility");
MethodInfo getAnnotations = type.GetMethod("GetAnnotations", BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo setGizmoEnabled = type.GetMethod("SetGizmoEnabled", BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo setIconEnabled = type.GetMethod("SetIconEnabled", BindingFlags.Static | BindingFlags.NonPublic);
It does indeed toggle gizmos and icons state but does not fix my performance issue. It is only when I toggle the gizmo button manually with the mouse that there is a change in performance…
Can you help me with that ?