Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
avatar image
0
Question by Khena_B · Feb 04, 2018 at 06:07 PM · transformdisablehierarchyhidefolder

Disable/Hide transform

Hey,

Is it possible to disable/hide the transform component/tools of a gameobject in the scene, i'm trying to make folder like gameobjects in my hierarchy that appears empty and non moveable.

I'm aware that i can use HideFlags.NotEditable | HideFlags.HideInInspector to hide the transform component but the object can still be moved with the handles.


Is it possible to hide/disable everything including the handles?


Thanks

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

4 Replies

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

Answer by Khena_B · Feb 04, 2018 at 08:16 PM

I seem to have found a way. First i created an empty "Folder" script:

 public class Folder : MonoBehaviour
 {
 }

and a CustomEditor script:

 [CanEditMultipleObjects]
 [CustomEditor(typeof(Folder))]
 public class FolderEditor : Editor 
 {
     private Folder folder;
 
     void OnEnable()
     {
         folder = (Folder)target;
         Tools.hidden = true;
     }
 
     void OnDisable()
     {
         Tools.hidden = false;
     }

When creating my folders in the hierarchy, i add the folder script and hide the transform component:

 GameObject newFolder = new GameObject(folderName);
 newFolder.AddComponent<Folder>();
 newFolder.transform.hideFlags = HideFlags.NotEditable | HideFlags.HideInInspector;

And now i have Gameobjects with no visible transform in the inspector and in the scene view.

Comment
Add comment · Show 2 · 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 lassade · Feb 04, 2018 at 08:29 PM 0
Share

Is hideFlags been serialized? Try open and close the scene

avatar image Khena_B lassade · Feb 04, 2018 at 08:32 PM 0
Share

I set HideFlags of all my folders OnEnable() from the script that creates the folders, it also re-orders them and stuff to make sure my folders are on top of the hierarchy.

avatar image
2

Answer by Salim · Feb 02, 2020 at 06:57 PM

Why not make a Monobehavior and hide the flags OnValidate() like this:

 public class Folder : MonoBehaviour 
     {
         void OnValidate()
         {
             transform.hideFlags = HideFlags.NotEditable | HideFlags.HideInInspector;
             this.hideFlags = HideFlags.NotEditable | HideFlags.HideInInspector;
         }
     }
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 Prastiwar · Feb 04, 2018 at 07:14 PM

I would be really grateful if Unity would add this option. Game would be much faster and hierarchy much more organized because if you could remove transform it would be easy to create (real) folders in hierarchy. For now.. Unity forces to use transform component in every single gameobject in scene.

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 lassade · Feb 04, 2018 at 07:48 PM

Maybe you could write a custom hierarchy window, with support to folders and stuff, It's doable but I think it will be kind hard to implement so maybe is not what you are looking forward to. Did you give a look at the asset store? Maybe you can find something.

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.

Follow this Question

Answers Answers and Comments

97 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

Related Questions

Disabling/Hiding a Text Field with Enter Key 4 Answers

transform.Find always returns null 1 Answer

mesh collider won't disable when using transform on his parent 0 Answers

transform.childCount == 0, but a child shows up in the hierarchy. How is this possible? 2 Answers

Moving objects together without parenting 5 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