using UnityEditor; using UnityEngine; namespace VketCloudGUITools.DependenciesImporter { public class EssentialObjectsImporter { private const string PrefabPath = "Packages/com.hikky.vketcloudguitools/PackageResources/Prefab/horizontal_modal.prefab"; [MenuItem("GameObject/Add essential objects for VketCloudGUITool")] private static void EssentialObject() { // Load the prefab at the specified path GameObject prefab = AssetDatabase.LoadAssetAtPath(PrefabPath); if (prefab == null) { Debug.LogError($"Prefab not found at path: {PrefabPath}"); return; } // Instantiate the prefab in the scene GameObject instance = PrefabUtility.InstantiatePrefab(prefab) as GameObject; if (instance != null) { // Select the newly created object Selection.activeGameObject = instance; // Optionally, position it at the origin instance.transform.position = Vector3.zero; } else { Debug.LogError("Failed to instantiate the prefab."); } } } }