Spaces:
Sleeping
Sleeping
Update UnityProject/Assets/Editor/TestBuilder.cs
Browse files3 unmodified lines4567789111011141213141518161721181920212522232425263027322829343031363738323334353637384339404146424344454647535455565748495051596061625253545556575868596061623 unmodified lines
public class TestBuilder{ // Path Input dan Output static readonly string RAW_PATH = "Assets/InputRaw"; static readonly string OUTPUT_DIR = "Assets/Output";
// KITA PAKAI FUNGSI INI SAJA (NATIVE UNITY) public static void ManualConvert() { Debug.Log("🚀 [NATIVE] Memulai Build AssetBundle..."); Debug.Log("🚀 [NATIVE] Memulai Build AssetBundle...");
try { // 1. Refresh Asset Database AssetDatabase.Refresh();
// 2. Cari Prefab di InputRaw // 1. Cari Prefab string[] guids = AssetDatabase.FindAssets("t:Prefab", new[] { RAW_PATH }); if (guids.Length == 0) { Debug.LogError("❌ Error: Tidak ada Prefab di Assets/InputRaw!"); Debug.LogError("⌠Error: Tidak ada Prefab di Assets/InputRaw!"); EditorApplication.Exit(1); return; }
// Ambil path prefab string prefabPath = AssetDatabase.GUIDToAssetPath(guids[0]); Debug.Log($"📄 Menggunakan Prefab: {prefabPath}"); Debug.Log($"📄 Prefab ditemukan: {prefabPath}");
// 3. SET ASSETBUNDLE NAME (Pura-pura jadi .zepeto) // 2. Set AssetBundle Name AssetImporter importer = AssetImporter.GetAtPath(prefabPath); if (importer == null) { Debug.LogError("❌ Gagal load AssetImporter."); if (importer == null) { Debug.LogError("⌠Gagal load AssetImporter."); EditorApplication.Exit(1); } // Ubah ekstensi jadi .zepeto (trik native) importer.assetBundleName = "repacked_item.zepeto";
// 4. SIAPKAN FOLDER OUTPUT // 3. Build AssetBundle if (!Directory.Exists(OUTPUT_DIR)) Directory.CreateDirectory(OUTPUT_DIR);
// 5. BUILD MURNI (Target Windows64 paling stabil di Docker) BuildPipeline.BuildAssetBundles( OUTPUT_DIR, BuildAssetBundleOptions.ForceRebuildAssetBundle, BuildTarget.StandaloneWindows64 );
// 6. VERIFIKASI FILE string expectedFile = Path.Combine(OUTPUT_DIR, "repacked_item.zepeto"); if (File.Exists(expectedFile)) { Debug.Log($"✅ SUKSES! File output: {expectedFile}"); // 4. Cek Hasil if (File.Exists(Path.Combine(OUTPUT_DIR, "repacked_item.zepeto"))) { Debug.Log("✅ Build Success!"); EditorApplication.Exit(0); } else { Debug.LogError("❌ Gagal! File output tidak terbentuk."); } else { Debug.LogError("⌠File output tidak terbentuk!"); EditorApplication.Exit(1); } } catch (System.Exception e) { Debug.LogError($"❌ CRITICAL ERROR: {e.Message}"); Debug.LogError($"⌠CRITICAL ERROR: {e.Message}"); EditorApplication.Exit(1); } }UnityProject/Assets/Editor/TestBuilder.cs+15-24