Skip to content

Commit 68858dd

Browse files
committed
code review fixes
1 parent dd0a090 commit 68858dd

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

com.unity.formats.fbx/Editor/ConvertToPrefabEditorWindow.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,24 @@ protected override void OnEnable()
103103
m_prefabExtLabelWidth = FbxExtLabelStyle.CalcSize(new GUIContent(".prefab")).x;
104104
}
105105

106-
protected bool ExportSetContainsRectTransform(out List<string> roots)
106+
/// <summary>
107+
/// Get a list of all the export set objects that contain
108+
/// RectTransforms or have children with RectTransforms.
109+
/// </summary>
110+
/// <param name="uiObjectNames">names of objects in set which contain RectTransforms</param>
111+
/// <returns>Whethere there are any UI elements in the export set</returns>
112+
protected bool GetUIElementsInExportSet(out List<string> uiObjectNames)
107113
{
108-
roots = new List<string>();
114+
uiObjectNames = new List<string>();
109115
foreach (var obj in GetToExport())
110116
{
111117
var go = ModelExporter.GetGameObject(obj);
112118
if (go.GetComponentInChildren<RectTransform>())
113119
{
114-
roots.Add(go.name);
120+
uiObjectNames.Add(go.name);
115121
}
116122
}
117-
return roots.Count > 0;
123+
return uiObjectNames.Count > 0;
118124
}
119125

120126
protected bool ExportSetContainsAnimation()
@@ -158,13 +164,13 @@ protected override bool Export()
158164
}
159165

160166
List<string> hierarchiesWithUI;
161-
if (ExportSetContainsRectTransform(out hierarchiesWithUI))
167+
if (GetUIElementsInExportSet(out hierarchiesWithUI))
162168
{
163169
// Warn that UI elements will break if converted
164-
string warning = string.Format("UI elements with RectTransform component present in the following hierarchies:\n\n{0}\n\nIf converted, RectTransform and other UI components may be lost",
170+
string warning = string.Format("RectTransform and other UI components will be lost if the following GameObject hierarchies are converted:\n\n{0}\n",
165171
string.Join("\n", hierarchiesWithUI));
166172
bool result = UnityEditor.EditorUtility.DisplayDialog(
167-
string.Format("{0} Warning", ModelExporter.PACKAGE_UI_NAME), warning, "Continue", "Cancel");
173+
string.Format("{0} Warning", ModelExporter.PACKAGE_UI_NAME), warning, "Convert and lose UI", "Cancel");
168174

169175
if (!result)
170176
{

0 commit comments

Comments
 (0)