示例#1
0
        public ViewItem(GameObject instance)
        {
            this.instance = instance;
            id            = instance.GetInstanceID();

            isPrefab         = PrefabUtility.GetPrefabAssetType(instance) == PrefabAssetType.Regular;
            isRootPrefab     = PrefabUtility.IsAnyPrefabInstanceRoot(instance);
            isCollection     = instance.TryGetComponent(out collection);
            isSubSceneHeader = TreeViewGUI.IsSubSceneHeader(instance);
            isEmpty          = instance.transform.childCount == 0;

            transform  = instance.transform;
            components = new Components(instance);

            gizmoIcon = ObjectIconUtil.GetIconForObject(instance);
            icon      = components.icon;

            if (prefs.showGizmoIcon && gizmoIcon != null)
            {
                icon = gizmoIcon;
            }

            if (isSubSceneHeader)
            {
                icon = sceneAssetIcon;
            }

            if (components.hasNullComponent)
            {
                icon = nullComponentIcon;
            }

            mainType = components.main?.GetType() ?? typeof(GameObject);

            if (isRootPrefab)
            {
                mainType = typeof(GameObject);
            }

            if (!isEmpty)
            {
                child = new ViewItem(transform.GetChild(0).gameObject);
            }
        }
 public TreeViewController(object controller)
 {
     data            = dataProperty.GetValue(controller);
     gui             = new TreeViewGUI(guiProperty.GetValue(controller));
     this.controller = controller;
 }