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

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.

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;
        }
    }

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.

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.