diff --git a/com.unity.perception/Editor/AssetPreparation/AssetPreparationTools.cs b/com.unity.perception/Editor/AssetPreparation/AssetPreparationTools.cs index 59e0e0091..6cf184f3d 100644 --- a/com.unity.perception/Editor/AssetPreparation/AssetPreparationTools.cs +++ b/com.unity.perception/Editor/AssetPreparation/AssetPreparationTools.cs @@ -1,26 +1,23 @@ -using System.IO; +using System.IO; using UnityEngine; namespace UnityEditor.Perception.AssetPreparation { - class AssetPreparationTools + static class AssetPreparationMenuItems { - class AssetPreparationMenuFunctions : MonoBehaviour + /// + /// Function for creating prefabs from multiple models with one click. Created prefabs will be placed in the same folder as their corresponding model. + /// + [MenuItem("Assets/Perception/Create Prefabs from Selected Models")] + static void CreatePrefabsFromSelectedModels() { - /// - /// Function for creating prefabs from multiple models with one click. Created prefabs will be placed in the same folder as their corresponding model. - /// - [MenuItem("Assets/Perception/Create Prefabs from Selected Models")] - static void CreatePrefabsFromSelectedModels() + foreach (var selection in Selection.gameObjects) { - foreach (var selection in Selection.gameObjects) - { - var path = AssetDatabase.GetAssetPath(selection); - var tmpGameObject = Instantiate(selection); - var destinationPath = Path.GetDirectoryName(path) + "/" + selection.name + ".prefab"; - PrefabUtility.SaveAsPrefabAsset(tmpGameObject, destinationPath); - DestroyImmediate(tmpGameObject); - } + var path = AssetDatabase.GetAssetPath(selection); + var tmpGameObject = Object.Instantiate(selection); + var destinationPath = Path.GetDirectoryName(path) + "/" + selection.name + ".prefab"; + PrefabUtility.SaveAsPrefabAsset(tmpGameObject, destinationPath); + Object.DestroyImmediate(tmpGameObject); } } }