Esempio n. 1
0
        private static void HandlePrefabOrPrefabInstanceStateLocking(HierarchyFolder hierarchyFolder, bool isPrefabAsset)
        {
            var transform = hierarchyFolder.transform;

            transform.hideFlags = HideFlags.NotEditable;

            var gameObject = transform.gameObject;

            if (gameObject.layer != DefaultLayer)
            {
                gameObject.layer = DefaultLayer;
            }

            hierarchyFolder.hideFlags = HideFlags.HideInInspector;

            if (!isPrefabAsset)
            {
                return;
            }

            if (HierarchyFolderUtility.HasSupernumeraryComponents(hierarchyFolder))
            {
                HierarchyFolderUtility.UnmakeHierarchyFolder(gameObject, hierarchyFolder);
                return;
            }

            HierarchyFolderUtility.ResetTransformStateWithoutAffectingChildren(transform);
        }
        private void UnmakeHierarchyFolder([CanBeNull] HierarchyFolder hierarchyFolder)
        {
            // If this hierarchy folder has already been destroyed we should abort.
            if (hierarchyFolder == null)
            {
                return;
            }

            destroying.Remove(hierarchyFolder);

            HierarchyFolderUtility.UnmakeHierarchyFolder(hierarchyFolder.gameObject, hierarchyFolder);
        }
Esempio n. 3
0
        private void ConvertToGameObjectIfHierarchyFolder()
        {
            var gameObject = AssetDatabase.LoadAssetAtPath <GameObject>(assetImporter.assetPath);

            if (gameObject == null)
            {
                return;
            }

            if (!gameObject.IsHierarchyFolder())
            {
                return;
            }

            Debug.LogWarning("Hierarchy Folders can only exist in the scene and as such can't be prefabs. Converting into a normal GameObject.", gameObject);
            HierarchyFolderUtility.UnmakeHierarchyFolder(gameObject, gameObject.GetComponent <HierarchyFolder>());
        }
 private void TurnIntoNormalGameObject()
 {
     HierarchyFolderUtility.UnmakeHierarchyFolder(gameObject, this);
 }
Esempio n. 5
0
 private static void UnmakeHierarchyFolder(GameObject gameObject)
 {
     Debug.LogWarning(HierarchyFolderMessages.PrefabNotAllowed, gameObject);
     HierarchyFolderUtility.UnmakeHierarchyFolder(gameObject, gameObject.GetComponent <HierarchyFolder>());
 }
Esempio n. 6
0
 private void UnmakeHierarchyFolder()
 {
     HierarchyFolderUtility.UnmakeHierarchyFolder(gameObject, this);
 }