@@ -103,6 +103,26 @@ protected override void OnEnable()
103
103
m_prefabExtLabelWidth = FbxExtLabelStyle . CalcSize ( new GUIContent ( ".prefab" ) ) . x ;
104
104
}
105
105
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 )
113
+ {
114
+ uiObjectNames = new List < string > ( ) ;
115
+ foreach ( var obj in GetToExport ( ) )
116
+ {
117
+ var go = ModelExporter . GetGameObject ( obj ) ;
118
+ if ( go . GetComponentInChildren < RectTransform > ( ) )
119
+ {
120
+ uiObjectNames . Add ( go . name ) ;
121
+ }
122
+ }
123
+ return uiObjectNames . Count > 0 ;
124
+ }
125
+
106
126
protected bool ExportSetContainsAnimation ( )
107
127
{
108
128
foreach ( var obj in GetToExport ( ) )
@@ -143,6 +163,21 @@ protected override bool Export()
143
163
return false ;
144
164
}
145
165
166
+ List < string > hierarchiesWithUI ;
167
+ if ( GetUIElementsInExportSet ( out hierarchiesWithUI ) )
168
+ {
169
+ // Warn that UI elements will break if converted
170
+ string warning = string . Format ( "RectTransform and other UI components will be lost if the following GameObject hierarchies are converted:\n \n {0}\n " ,
171
+ string . Join ( "\n " , hierarchiesWithUI ) ) ;
172
+ bool result = UnityEditor . EditorUtility . DisplayDialog (
173
+ string . Format ( "{0} Warning" , ModelExporter . PACKAGE_UI_NAME ) , warning , "Convert and lose UI" , "Cancel" ) ;
174
+
175
+ if ( ! result )
176
+ {
177
+ return false ;
178
+ }
179
+ }
180
+
146
181
if ( SettingsObject . UseMayaCompatibleNames && SettingsObject . AllowSceneModification )
147
182
{
148
183
string warning = "Names of objects in the hierarchy may change with the Compatible Naming option turned on" ;
0 commit comments