Skip to content

Commit d4799ce

Browse files
committed
give warning when trying to convert child of prefab asset
1 parent 5ead3e2 commit d4799ce

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ public static GameObject[] CreateInstantiatedModelPrefab(
161161
return null;
162162
}
163163

164+
if (PrefabUtility.IsPartOfPrefabAsset(go) && go.transform.parent != null)
165+
{
166+
DisplayInvalidSelectionDialog(go,
167+
"Children of a Prefab Asset cannot be converted.\nYou can open the Prefab in Prefab Mode or unpack the Prefab instance to convert it's children");
168+
return null;
169+
}
170+
164171
// can't currently handle converting root of prefab in prefab preview scene
165172
if (SceneManagement.EditorSceneManager.IsPreviewSceneObject(go) && go.transform.parent == null)
166173
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ protected bool OverwriteExistingFile(string filePath){
462462
if (System.IO.File.Exists (filePath)) {
463463
bool overwrite = UnityEditor.EditorUtility.DisplayDialog (
464464
string.Format("{0} Warning", ModelExporter.PACKAGE_UI_NAME),
465-
string.Format("File {0} already exists.\nOverwrite cannot be undone", filePath),
465+
string.Format("File {0} already exists.\nOverwrite cannot be undone.", filePath),
466466
"Overwrite", "Cancel");
467467
if (!overwrite) {
468468
if (GUI.changed) {

0 commit comments

Comments
 (0)