Example #1
0
        void DisappearUnreferenceObjects()
        {
            isHiding = true;

            var refObjectList = new List <ReferenceObject>();
            var allObject     = SceneObjectUtility.GetAllObjectsInScene(false);

            foreach (var obj in allObject)
            {
                obj.hideFlags = HideFlags.HideInHierarchy;
                SceneObjectUtility.GetReferenceObject(obj, refObjectList);
            }
            refObjectList.Sort((x, y) => { return(x.referenceComponent.GetInstanceID() - y.referenceComponent.GetInstanceID()); });

            foreach (var item in refObjectList)
            {
                ParentShow(item.referenceComponent.transform);
                if (item.value == null)
                {
                    continue;
                }

                var obj = SceneObjectUtility.GetGameObject(item.value);

                if (obj != null)
                {
                    ParentShow(obj.transform);
                }
            }
        }
Example #2
0
        public void OnSelectionChange()
        {
            referenceObjectList.Clear();
            perhapsReferenceObjectList.Clear();

            SceneObjectUtility.UpdateReferenceList();

            foreach (var selection in Selection.gameObjects)
            {
                SceneObjectUtility.GetReferenceObject(selection, referenceObjectList);

                if (findWillAccessComponent)
                {
                    foreach (var component in selection.GetComponents <MonoBehaviour>())
                    {
                        UpdatePerahpsReferenceObjectList(component, perhapsReferenceObjectList);
                    }
                }
            }


            if (ignoreSelfReference)
            {
                foreach (var selection in Selection.gameObjects)
                {
                    referenceObjectList.RemoveAll(item => SceneObjectUtility.GetGameObject(item.value) == selection);
                }
            }

            refCompItems.Clear();

            if (findWillAccessComponent)
            {
                foreach (var selection in Selection.gameObjects)
                {
                    foreach (var component in selection.GetComponents <MonoBehaviour>())
                    {
                        if (!refCompItems.Exists(item => item.componentType == component.GetType()))
                        {
                            refCompItems.Add(new ReferenceObjectItem()
                            {
                                componentType = component.GetType(),
                                isDisplay     = true,
                            });
                        }
                    }
                }

                foreach (var obj in referenceObjectList)
                {
                    perhapsReferenceObjectList.RemoveAll(item => item.referenceMonobehaviourName == obj.value.GetType().Name);
                }
            }
            else
            {
                foreach (var referenceObject in referenceObjectList)
                {
                    if (!refCompItems.Exists(item => item.componentType == referenceObject.referenceComponent.GetType()))
                    {
                        refCompItems.Add(new ReferenceObjectItem()
                        {
                            componentType = referenceObject.referenceComponent.GetType(),
                            isDisplay     = true,
                        });
                    }
                }
            }
        }