Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
avatar image
3
Question by ComradeVanti · Nov 16, 2016 at 05:14 PM · scripting problemeditorupdatehierarchyhideflags

HideFlags.HideInHierarchy not updating hierarchy in Edit-mode

Hey there guys.

So here is the deal:

I made a window to allow me to quickly hide and unhide objects in my hierarchy. Here it is:

alt text

Yeah.... I'm making a MLG-style-game. Dont judge me :P

Alright. So to hide my objects I use this:

 foreach (GameObject effect in GameObject.FindGameObjectsWithTag("Effect")) {
                 effect.SetActive (false);
                 if (effectsVisible)
                     effect.hideFlags = HideFlags.None;
                 else
                     effect.hideFlags = HideFlags.HideInHierarchy;
                 effect.SetActive (true);
                 Repaint ();
                 EditorApplication.RepaintHierarchyWindow ();
             }

This is the "Effects visible" button. This should work but... it doesnt really. The hierarchyjust doesnt update when I press the button, It does however update when I close and reopen it. Then my Hideflags are set correctly.

Is there a way to reload the hierarchy via script or to set the hideflags in a way that automatically updates the hierarchy?

Thanks in advance guys :D

window.png (20.3 kB)
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 Rodiaz89 · Dec 03, 2016 at 09:38 AM

I had the same issue @Brullix3000

Try adding this after the RepaintHierarchyWindow

 EditorApplication.DirtyHierarchyWindowSorting();


Comment
Add comment · Show 6 · 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 ComradeVanti · Dec 04, 2016 at 09:58 AM 0
Share

This did the trick. Thanks alot m8 :D

avatar image Adam-Mechtley · Dec 04, 2016 at 10:30 AM 0
Share

Thanks! Would one of you $$anonymous$$d filing a bug report on this so it gets to the Asset $$anonymous$$anagement $$anonymous$$m?

avatar image ComradeVanti Adam-Mechtley · Dec 04, 2016 at 06:41 PM 0
Share

I already did :)

avatar image Adam-Mechtley ComradeVanti · Dec 05, 2016 at 07:31 AM 0
Share

Ah right sorry! There was another thread with a similar problem, too :)

avatar image Ben-BearFish · Apr 04, 2018 at 11:27 PM 0
Share

Can anyone confirm if this is how to do this for an Editor script? I can't get the hideflags to work in the OnInspectorGUI in an Editor script.

avatar image Stacklucker · Mar 04 at 05:25 AM 0
Share

This still doesn't work for me in 2020.3.25

avatar image
1

Answer by Quatum1000 · Jul 24, 2017 at 05:18 PM

In my case the only way in 2017.b10 is to use after GameObject.hideFlags;

 #if UNITY_EDITOR
             try { EditorApplication.DirtyHierarchyWindowSorting(); } catch { }
 #endif
 

Otherwise if the script will be enabled and disabled during any reason I got an Fatal Reference Error spam.

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
avatar image
0

Answer by Adam-Mechtley · Nov 17, 2016 at 09:04 AM

I messed with this a bit and it actually looks like a bug to me. Could you submit a bug report please?

Comment
Add comment · Show 3 · 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 ComradeVanti · Nov 20, 2016 at 08:31 AM 0
Share

Alright will do.

Did you find a workaround or will I just have to deal with it?

avatar image Adam-Mechtley ComradeVanti · Nov 20, 2016 at 09:38 AM 0
Share

I did not, but if you file a bug it should end up with the Asset $$anonymous$$anagement $$anonymous$$m, who would be in a better position to let you know if there's a workaround, if this behavior is somehow expected, etc.

avatar image ComradeVanti Adam-Mechtley · Nov 20, 2016 at 10:38 AM 0
Share

Alright thanks m8. I sent a report. Let's see what they have to say :)

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.

Follow this Question

Answers Answers and Comments

109 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

HideFlags and Prefabs 1 Answer

Any easy way to choose the method called when clicking a button? 0 Answers

Set parent of dragged object to selected GameObject in hierarchy 0 Answers

Preventing name duplication in Hierarchy(getting selected GameObject) 1 Answer

ArgumentOutOfRangeException is occuring when it shouldn't 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