webzepetoku commited on
Commit
2aa5bbb
·
verified ·
1 Parent(s): ccfce3d

Update UnityProject/Assets/Editor/TestBuilder.cs

Browse files
UnityProject/Assets/Editor/TestBuilder.cs CHANGED
@@ -7,7 +7,6 @@ using UnityMeshSimplifier;
7
  public class TestBuilder
8
  {
9
  static readonly string RAW_PATH = "Assets/InputRaw";
10
- // Folder assetbundles dibuat DI DALAM InputRaw agar ikut terbungkus nanti
11
  static readonly string ASSETBUNDLE_DIR = "Assets/InputRaw/assetbundles";
12
 
13
  public static void ManualConvert()
@@ -25,33 +24,33 @@ public class TestBuilder
25
  {
26
  AssetDatabase.Refresh();
27
 
28
- // 1. Ambil semua file aset (PNG, Prefab, Shader)
29
  string[] allAssets = Directory.GetFiles(RAW_PATH, "*.*", SearchOption.AllDirectories)
30
  .Where(s => !s.EndsWith(".meta") && !s.Contains("assetbundles")).ToArray();
31
 
32
  if (!Directory.Exists(ASSETBUNDLE_DIR)) Directory.CreateDirectory(ASSETBUNDLE_DIR);
33
 
34
- // 2. PROSES RIMPANG & LABELING
35
  foreach (BuildTarget t in targets)
36
  {
37
- string platformName = t.ToString(); // Nama binary: Android, StandaloneLinux64, dll.
38
 
39
  foreach (string path in allAssets)
40
  {
41
- // Rampingkan Mesh 50% sebelum build
42
  if (path.EndsWith(".prefab") || path.EndsWith(".fbx")) {
43
  GameObject go = AssetDatabase.LoadAssetAtPath<GameObject>(path);
44
  if (go != null) SimplifyMeshInGameObject(go);
45
  }
46
 
47
- // Beri label bundle sesuai platform (biar binary-nya gak punya ekstensi)
48
  AssetImporter importer = AssetImporter.GetAtPath(path);
49
  if (importer != null) importer.assetBundleName = platformName;
50
  }
51
 
52
- Debug.Log($"🔨 [UNITY] Membangun binary platform: {platformName}");
53
 
54
- // Build binary tanpa ekstensi ke dalam folder assetbundles
55
  BuildPipeline.BuildAssetBundles(
56
  ASSETBUNDLE_DIR,
57
  BuildAssetBundleOptions.ForceRebuildAssetBundle,
@@ -59,7 +58,7 @@ public class TestBuilder
59
  );
60
  }
61
 
62
- Debug.Log("✅ [UNITY] Semua platform berhasil dibuat di dalam folder assetbundles.");
63
  EditorApplication.Exit(0);
64
  }
65
  catch (System.Exception e) {
 
7
  public class TestBuilder
8
  {
9
  static readonly string RAW_PATH = "Assets/InputRaw";
 
10
  static readonly string ASSETBUNDLE_DIR = "Assets/InputRaw/assetbundles";
11
 
12
  public static void ManualConvert()
 
24
  {
25
  AssetDatabase.Refresh();
26
 
27
+ // 1. Ambil semua aset asli di folder InputRaw
28
  string[] allAssets = Directory.GetFiles(RAW_PATH, "*.*", SearchOption.AllDirectories)
29
  .Where(s => !s.EndsWith(".meta") && !s.Contains("assetbundles")).ToArray();
30
 
31
  if (!Directory.Exists(ASSETBUNDLE_DIR)) Directory.CreateDirectory(ASSETBUNDLE_DIR);
32
 
33
+ // 2. PROSES PERAMPINGAN (SIMPLIFY) & LABELING
34
  foreach (BuildTarget t in targets)
35
  {
36
+ string platformName = t.ToString();
37
 
38
  foreach (string path in allAssets)
39
  {
40
+ // Rampingkan poligon 50% untuk file 3D
41
  if (path.EndsWith(".prefab") || path.EndsWith(".fbx")) {
42
  GameObject go = AssetDatabase.LoadAssetAtPath<GameObject>(path);
43
  if (go != null) SimplifyMeshInGameObject(go);
44
  }
45
 
46
+ // Beri label bundle sesuai nama platform (agar binary tanpa ekstensi)
47
  AssetImporter importer = AssetImporter.GetAtPath(path);
48
  if (importer != null) importer.assetBundleName = platformName;
49
  }
50
 
51
+ Debug.Log($"🚀 [UNITY] Membangun binary platform: {platformName}");
52
 
53
+ // Build binary platform tanpa ekstensi ke dalam folder assetbundles/
54
  BuildPipeline.BuildAssetBundles(
55
  ASSETBUNDLE_DIR,
56
  BuildAssetBundleOptions.ForceRebuildAssetBundle,
 
58
  );
59
  }
60
 
61
+ Debug.Log("✅ [UNITY] Build binary selesai.");
62
  EditorApplication.Exit(0);
63
  }
64
  catch (System.Exception e) {