Spaces:
Sleeping
Sleeping
Update UnityProject/Assets/Editor/TestBuilder.cs
Browse files55 unmodified lines56575859596061624 unmodified lines676869707071722 unmodified lines757677797879802 unmodified lines838485888687889189909192939496979899959697981019910010110210310410510610710810911010811111211311011411511211611711811912055 unmodified lines } }
// --- PEMBERSIHAN RAM AWAL --- // --- PEMBERSIHAN RAM AGRESIF SETELAH SIMPLIFY --- EditorUtility.UnloadUnusedAssetsImmediate(); GC.Collect();
4 unmodified lines foreach (string path in allAssets) { // Beri label bundle sesuai nama platform (agar binary masuk ke assetbundles) AssetImporter importer = AssetImporter.GetAtPath(path); if (importer != null) importer.assetBundleName = platformName; }2 unmodified lines try { // Binary dilempar ke dalam sub-folder assetbundles/ BuildPipeline.BuildAssetBundles( ASSETBUNDLE_DIR, BuildAssetBundleOptions.ForceRebuildAssetBundle, 2 unmodified lines } catch (System.Exception ex) { Debug.LogWarning($"⚠️ [UNITY] Gagal build untuk {platformName}. Error: {ex.Message}"); Debug.LogWarning($"⚠️ [UNITY] Gagal build untuk {platformName}. Modul tidak tersedia. Error: {ex.Message}"); }
// --- PEMBERSIHAN RAM SETIAP SELESAI SATU PLATFORM (Mencegah Exit Code 137) --- // --- PEMBERSIHAN RAM SETIAP SELESAI SATU PLATFORM (Penting untuk mencegah 137) --- EditorUtility.UnloadUnusedAssetsImmediate(); GC.Collect(); Resources.UnloadUnusedAssets(); } // 5. PROSES REPACKING FOLDER UTAMA MENJADI .ZEPETO DENGAN TIMESTAMP UNIK Debug.Log($"📦 [UNITY] Memulai proses repacking Folder Utama ({MAIN_FOLDER}) menjadi .zepeto..."); // PEMBUATAN NAMA FILE UNIK DENGAN TIMESTAMP // 5. PROSES REPACKING DENGAN TIMESTAMP UNIK // Mengambil nama folder utama (misal 'InputRaw' atau 'hairku') string folderName = new DirectoryInfo(MAIN_FOLDER).Name; string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss"); string repackFile = $"Assets/Repacked_{timestamp}.zepeto"; // NAMA FILE HARUS UNIK (Contoh: hairku_20260219_180800.zepeto) string fileName = $"{folderName}_{timestamp}.zepeto"; string repackFile = Path.Combine("Assets", fileName);
Debug.Log($"📦 [PACKING] Membuat archive {fileName}...");
if (File.Exists(repackFile)) { File.Delete(repackFile); } // Yang di-pack adalah folder utama (isinya: prefab, assetbundles, dsb) // Pack seluruh folder utama termasuk sub-folder assetbundles ZipFile.CreateFromDirectory(MAIN_FOLDER, repackFile); Debug.Log($"✅ [UNITY] Repacking selesai: {repackFile}"); Debug.Log($"✅ [UNITY] Build & Repacking Sukses: {repackFile}");
Debug.Log("✅ [UNITY] Seluruh rangkaian build dan repacking selesai."); // Segarkan agar file baru muncul di sistem AssetDatabase.Refresh(); EditorApplication.Exit(0); } catch (System.Exception e) {UnityProject/Assets/Editor/TestBuilder.cs+18-13