How can I access the 2nd tier of children on a prefab in the Project Folder Window?

I want to access the child of a child of a prefab in the Project Folder Window, but Unity doesn’t allow you to.

Here’s what I mean…

This is what my prefab looks like in the Hierarchy Window. Notice how I can access “Marker” which is a child of a child of the parent prefab.

40347-1.png

Now this is the same prefab in the Project Folder Window: For some reason Unity only lets me view the first tier of the prefab’s children, and hence I can’t access “Marker”.

40348-2.png

Is there a reason Unity does this? Because I need to access the lower tiered children to set up dependencies in the inspector window. I understand I could just make everything a tier 1 child, but this would make my objects very unorganized and hard to work with.

Any help with this would be really appreciated!

From this post

That is by design - from a scene, you
can make references to game objects
you can see in the project view; the
ones nested down one level in a
prefab.

We’ve limited that to one level for a
few reasons:

  • A larger level made by an artist can have many, many game objects inside
    it. Letting people make references to
    game objects deep in the hierarchy
    seemed to be dangerous, as it would be
    too easy to introduce code
    dependencies on arbitrary art assets.

  • In code-based prefabs, its usually more flexible to have some accessor
    properties in the root game object
    that has pointers to what you need.

It seems to me that allowing deletion
of gameobjects directly inside prefabs
is actually a bad idea. Don’t you want
to see what you’re doing? (If you are
a programmer who has a complex manager
setup, you can probably handle it -
but prefabs are also used for
graphics, and there you want to see
what you do anyways)

And also a good offer to solve the issue

Double-clicking a prefab brings to you
to a scene view with just that prefab
instantiated in the scene hierarchy.
So you can see the prefab in 3D, edit
whatever you need to, and then when
you close out of this view it goes
back to whatever level you were
previously editing…

Note that you can work around this by selecting an instance of the prefab in the Hierarchy view and selecting “Select Prefab” in the context menu. It’s a pain, but it does work.

Hi,

i think the traversing level in the project window is limited by default and you cant change that.

Take a look into this forum post. Maybe someone has a solution for you.
http://forum.unity3d.com/threads/showing-deeper-nested-levels-in-prefabs-project-view.8101/

[MenuItem(“Assets/Tools/WinxProduction/Expand Prefab”)]
public static void ExpandPrefab() {

        GameObject go = Selection.activeGameObject;

        Debug.Log(PrefabUtility.FindPrefabRoot(go));

        if (go != null && PrefabUtility.GetPrefabType(go) == PrefabType.Prefab) {

            //only first level are shown, so check deeper
            foreach (Transform child in go.transform) {
                if (child != go.transform) {

                    child.gameObject.Traverse((gameObject) => gameObject.hideFlags &= (~(HideFlags.HideInHierarchy)));
                }
            }

            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(go), ImportAssetOptions.ForceUpdate);

        }

    }

    [MenuItem("Assets/Tools/WinxProduction/Collaps Prefab")]
    public static void CollapsPrefab() {

        GameObject go = Selection.activeGameObject;

        if (go != null && PrefabUtility.GetPrefabType(go) == PrefabType.Prefab) {

            //only first level are shown, so check deeper
            foreach (Transform child in go.transform) {
                if (child != go.transform) {

                    child.gameObject.Traverse((gameObject) => gameObject.hideFlags |= HideFlags.HideInHierarchy);
                }
            }

            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(go), ImportAssetOptions.ForceUpdate);

        }

    }

public static class GameObjectExtensions {




        public static void Traverse(this GameObject obj,Action<GameObject> action)
        {

            foreach (Transform child in obj.transform)
            {
                if(child!=obj.transform){

                    action(child.gameObject);

                    Traverse(child.gameObject,action);
                }



            }

        }



    }

Above will show you all levels but you wont see the hierarchy. So if you want that
GitHub - robotron2084/phinspector: Prefab Hierarchy Inspector for the Unity3D game engine. and don’t want to create instances(I don’t)

alt text