Example #1
0
        internal static void RefreshEditableObject(GameObject gameObject)
        {
            bool editable           = ShouleBeEditable(gameObject);
            bool parentEditable     = gameObject.transform.parent ? ShouleBeEditable(gameObject.transform.parent.gameObject) : VCUtility.HaveAssetControl(SceneManagerUtilities.GetCurrentScenePath());
            bool prefabHeadEditable = PrefabHelper.IsPrefabRoot(gameObject) && parentEditable;

            if (prefabHeadEditable)
            {
                SetEditable(gameObject, true);
            }
            else
            {
                SetEditable(gameObject, editable);
            }

            foreach (var componentIt in gameObject.GetComponents <Component>())
            {
                if (prefabHeadEditable && componentIt == gameObject.transform)
                {
                    SetEditable(gameObject.transform, true);
                }
                else
                {
                    RefreshEditableComponent(gameObject, componentIt);
                }
            }
        }
Example #2
0
        public static string GetObjectTypeName(Object obj)
        {
            string objectType = "Unknown Type";

            if (PrefabHelper.IsPrefab(obj, false, true, true))
            {
                objectType = PrefabHelper.IsPrefabParent(obj) ? "Model" : "Model in Scene";
            }
            if (PrefabHelper.IsPrefab(obj, true, false, true))
            {
                objectType = "Prefab";
            }
            if (!PrefabHelper.IsPrefab(obj, true, true, true))
            {
                objectType = "Scene";
            }

            if (PrefabHelper.IsPrefab(obj, true, false, true))
            {
                if (PrefabHelper.IsPrefabParent(obj))
                {
                    objectType += " Asset";
                }
                else if (PrefabHelper.IsPrefabRoot(obj))
                {
                    objectType += " Root";
                }
                else
                {
                    objectType += " Child";
                }
            }

            return(objectType);
        }