Example #1
0
 private void CloseAllCreated(SerializedProperty arrayProp)
 {
     TrySaveAllPrefabs(arrayProp);
     for (int i = 0; i < arrayProp.arraySize; i++)
     {
         var item           = arrayProp.GetArrayElementAtIndex(i);
         var instanceIDPorp = item.FindPropertyRelative("instanceID");
         var obj            = EditorUtility.InstanceIDToObject(instanceIDPorp.intValue);
         if (obj != null)
         {
             UISystemUtility.ApplyPrefab(obj as GameObject);
             DestroyImmediate(obj);
         }
         instanceIDPorp.intValue = 0;
     }
 }
Example #2
0
    protected virtual void HideItemIfInstenced()
    {
        var obj = EditorUtility.InstanceIDToObject(instanceIDProp.intValue);

        if (obj != null)
        {
            var go = obj as GameObject;
            UISystemUtility.ApplyPrefab(go);
            if (go.transform.parent.GetComponent <UIGroup>() == null && go.transform.parent.childCount == 1)
            {
                Object.DestroyImmediate(go.transform.parent.gameObject);
            }
            else
            {
                Object.DestroyImmediate(obj);
            }
        }
        instanceIDProp.intValue = 0;
    }