Пример #1
0
    // Ensure the prefab validity :
    // Either a functionning hierarchical prefab or a clean classic prefab.
    public static void EnsurePrefabValidity(GameObject a_rPrefabGameObjectToCheck)
    {
        // If the prefab is still valid don't bother updating it
        HierarchicalPrefabInstance rHierarchicalPrefabInstanceModel = a_rPrefabGameObjectToCheck.GetComponent <HierarchicalPrefabInstance>();

        if (rHierarchicalPrefabInstanceModel == null || rHierarchicalPrefabInstanceModel.IsValid() == false)
        {
            // If it's not a hierarchical prefab, ensure that the prefab is clean
            NestedPrefabEditorUtility.DisconnectResourceFromHierarchicalPrefab(a_rPrefabGameObjectToCheck);
        }
    }
 // Disconnect button action
 private void DisconnectButtonAction()
 {
     if (EditorUtility.IsPersistent(m_rSelectedGameObject))
     {
         NestedPrefabEditorUtility.DisconnectResourceFromHierarchicalPrefab(m_rSelectedGameObject);
     }
     else
     {
         NestedPrefabEditorUtility.DisconnectFromHierarchicalPrefabAndFromClassicPrefab(ref m_rSelectedGameObject);
         Selection.activeGameObject = m_rSelectedGameObject;
     }
 }