File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Assets/FbxExporters/Editor Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,15 @@ public void Dispose () { }
33
33
public static void OnMenuItem ( )
34
34
{
35
35
GameObject [ ] unityGameObjectsToConvert = Selection . GetFiltered < GameObject > ( SelectionMode . Editable | SelectionMode . TopLevel ) ;
36
+ if ( unityGameObjectsToConvert . Length <= 0 ) {
37
+ ModelExporter . DisplayNoSelectionDialog ( ) ;
38
+ return ;
39
+ }
40
+
36
41
Object [ ] result = CreateInstantiatedModelPrefab ( unityGameObjectsToConvert ) ;
37
- if ( result . Length > 0 )
42
+ if ( result . Length > 0 ) {
38
43
Selection . objects = result ;
44
+ }
39
45
}
40
46
41
47
/// <summary>
Original file line number Diff line number Diff line change @@ -1112,6 +1112,10 @@ private void ReplaceFile ()
1112
1112
[ MenuItem ( MenuItemName , false ) ]
1113
1113
public static void OnMenuItem ( )
1114
1114
{
1115
+ if ( Selection . objects . Length <= 0 ) {
1116
+ DisplayNoSelectionDialog ( ) ;
1117
+ return ;
1118
+ }
1115
1119
OnExport ( ) ;
1116
1120
}
1117
1121
@@ -1131,9 +1135,21 @@ public static bool OnValidateMenuItem ()
1131
1135
[ MenuItem ( "GameObject/Export Model..." , false , 30 ) ]
1132
1136
static void OnContextItem ( MenuCommand command )
1133
1137
{
1138
+ if ( Selection . objects . Length <= 0 ) {
1139
+ DisplayNoSelectionDialog ( ) ;
1140
+ return ;
1141
+ }
1134
1142
OnExport ( ) ;
1135
1143
}
1136
1144
1145
+ public static void DisplayNoSelectionDialog ( )
1146
+ {
1147
+ UnityEditor . EditorUtility . DisplayDialog (
1148
+ "Fbx Exporter Warning" ,
1149
+ "No GameObjects selected for export." ,
1150
+ "Ok" ) ;
1151
+ }
1152
+
1137
1153
//
1138
1154
// export mesh info from Unity
1139
1155
//
You can’t perform that action at this time.
0 commit comments