private void CloseAllCreated(UIInfoBase[] infoList) { TrySaveAllPrefabs(infoList); for (int i = 0; i < infoList.Length; i++) { var item = infoList[i]; var obj = EditorUtility.InstanceIDToObject(item.instanceID); if (obj != null) { BridgeEditorUtility.ApplyPrefab(obj as GameObject); DestroyImmediate(obj); } item.instanceID = 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) { BridgeEditorUtility.ApplyPrefab(obj as GameObject); DestroyImmediate(obj); } instanceIDPorp.intValue = 0; } }
protected virtual void HideItemIfInstenced() { var obj = EditorUtility.InstanceIDToObject(instanceIDProp.intValue); if (obj != null) { var go = obj as GameObject; BridgeEditorUtility.ApplyPrefab(go); if (go.transform.parent.GetComponent <PanelGroup>() == null && go.transform.parent.childCount == 1) { Object.DestroyImmediate(go.transform.parent.gameObject); } else { Object.DestroyImmediate(obj); } } instanceIDProp.intValue = 0; }