• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by chrismarch · Nov 20, 2014 at 09:51 PM · gizmos

"Uncheck all" in Gizmos menu in Scene view?

How do I uncheck all the checkboxes under the column "gizmo" in the Gizmos menu, in the Scene view of the Unity Editor, without clicking each one individually? Our project has hundreds of these, and each time I need to help a new artist (or someone running a new beta install) with them, we have to mouse click each individually.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by Immanuel-Scholz · Nov 20, 2014 at 11:42 PM

There is no official way (none I am aware of), but depending on your willingness to dig into deep private reflection stuff of UnityEditor.dll, you could write some editor code to do this.

Basically from what I see from the decompile, class AnnotationWindow controls the UI. It uses AnnotationUtility.GetAnnotations to obtain information about what classes have gizmos available and uses AnnotationUtility.SetGizmoEnabled to enable/disable the gizmo (SetIconEnabled to enable/disable the icon).

Let me try... yea, this one should work.. here you go: Menu option "Window / Disable All Gizmos" to turn off everything in a blink.

 using UnityEditor;
 using System;
 using System.Reflection;
 
 public class DisableAllGizmos
 {
     [MenuItem("Window/Disable All Gizmos")]
     static void DisableAllGizmosMenu()
     {
         var Annotation = Type.GetType("UnityEditor.Annotation, UnityEditor");
         var ClassId = Annotation.GetField("classID");
         var ScriptClass = Annotation.GetField("scriptClass");
         
         Type AnnotationUtility = Type.GetType("UnityEditor.AnnotationUtility, UnityEditor");
         var GetAnnotations = AnnotationUtility.GetMethod("GetAnnotations", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
         var SetGizmoEnabled = AnnotationUtility.GetMethod("SetGizmoEnabled", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
         var SetIconEnabled = AnnotationUtility.GetMethod("SetIconEnabled", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
 
         Array annotations = (Array)GetAnnotations.Invoke(null, null);
         foreach (var a in annotations)
         {
             int classId = (int)ClassId.GetValue(a);
             string scriptClass = (string)ScriptClass.GetValue(a);
 
             SetGizmoEnabled.Invoke(null, new object[] { classId, scriptClass, 0 });
             SetIconEnabled.Invoke(null, new object[] { classId, scriptClass, 0 });
         }
     }
 }
 

Comment
Add comment · Show 11 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PvTGreg · Dec 04, 2014 at 02:19 PM 0
Share

what would i change so that i can turn on all gizmos?

avatar image Bunny83 · Dec 04, 2014 at 02:34 PM 1
Share

@pvtgreg: Well, in line 25 you would pass "1" ins$$anonymous$$d of "0". Same in line 26 for SetIconEnabled.

avatar image markgrossnickle · Feb 22, 2019 at 06:07 PM 0
Share

Created a request to make this easier: https://feedback.unity3d.com/suggestions/please-add-ability-to-disable-slash-hide-all-gizmos

avatar image Sebastien-VL · Sep 27, 2019 at 09:45 AM 0
Share

Hello, Is there an update of this wonderfull script for Unity 2019 ? It still working in 2018 but not in 2019. From tracing the code it seems the Field name changed, "scriptClass" for example return "null". Cheers,

avatar image Grizmu Sebastien-VL · Sep 27, 2019 at 10:15 AM 1
Share

To make it work again in Unity 2019.x In row 25 change: SetGizmoEnabled.Invoke(null, new object[] { classId, scriptClass, 0 }); to: SetGizmoEnabled.Invoke(null, new object[] { classId, scriptClass, 0, false });

avatar image Sebastien-VL Grizmu · Sep 30, 2019 at 01:26 AM 0
Share

Thanks a lot, it fixed it.

How did you manage to find this, my knowledge in C# reflexion system was too low to find you by myself.

As I used it for also enabling all gizmo and restore/save state, here's a precision It's the '0' parameter that disable not the 'false'. SetGizmoEnabled.Invoke(null, new object[] { classId, scriptClass, _enabled ? 1 : 0,false });

Show more comments
avatar image AtomsInTheVoid · Oct 20, 2020 at 05:07 PM 0
Share

How would I modify this to preserve the state of the previous checked/unchecked gizmos? Currently this script will all or nothing it. If I had 10 Gizmos manually disabled, they'll all be set back to enabled after I reverse the script (by putting 1 instead of 0)... so need to keep a list of all gizmo's state first and then choose 1 or 0 depending on that list..

Need a "GetGizmoEnabled.Invoke"

Any ideas?

Show more comments
avatar image
4

Answer by MSGVentures · May 11, 2017 at 11:53 AM

One quick and easy way to hide all the gizmos is to open the Gizmos menu in the Scene viewer and make sure 3D Icons is checked. Then slide the size slider all the way to the left so they shrink down to nothing.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image markgrossnickle · Feb 22, 2019 at 06:07 PM 0
Share

Created a request to make this easier: https://feedback.unity3d.com/suggestions/please-add-ability-to-disable-slash-hide-all-gizmos

avatar image
1

Answer by Grizmu · Jul 23, 2019 at 02:55 PM

If you want to do something about it, and don't feel like figuring all the reflection methods out, or have no time to do so, I've released an asset called VoltGizmos, which allows you to show/hide all gizmos/icons with one click, as well as create your own snapshots.


It'll prove useful to you especially if you have lots of custom objects, which use gizmos, and the scene view feels more like a slideshow than a fluid experience, but you don't want to toggle gizmos manually all the time, as it's tiresome.


Here you can check the workflow comparison: Video

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gizmos.DrawCube bug? Doesn't like lots of calls. 1 Answer

Gizmo disappeared when custom editor 0 Answers

Every collider gizmo is black now 1 Answer

How do I select gizmos by mouse clicking in the editor? 1 Answer

How to build Gizmos Handles 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges