Spaces:
webzepetoku
/
Sleeping

webzepetoku commited on
Commit
f47270c
ยท
verified ยท
1 Parent(s): a2551bc

Update UnityProject/Assets/Editor/TestBuilder.cs

Browse files
UnityProject/Assets/Editor/TestBuilder.cs CHANGED
@@ -18,7 +18,6 @@ public class TestBuilder
18
  Debug.Log("๐Ÿ› ๏ธ [ZEPETO] Memulai optimasi mesh standar 2020...");
19
  AssetDatabase.Refresh();
20
 
21
- // Bersihkan folder output
22
  if (Directory.Exists(EXPORT_DIR)) Directory.Delete(EXPORT_DIR, true);
23
  if (Directory.Exists(BUNDLE_DIR)) Directory.Delete(BUNDLE_DIR, true);
24
  Directory.CreateDirectory(EXPORT_DIR);
@@ -26,39 +25,33 @@ public class TestBuilder
26
 
27
  string[] prefabPaths = Directory.GetFiles("Assets/InputRaw", "*.prefab", SearchOption.AllDirectories);
28
 
29
- if (prefabPaths.Length == 0) {
30
- Debug.LogError("โŒ [ERROR] Tidak ada file prefab di Assets/InputRaw");
31
- EditorApplication.Exit(1);
32
- }
33
-
34
  foreach (string path in prefabPaths)
35
  {
36
  GameObject go = PrefabUtility.LoadPrefabContents(path);
37
  if (go != null)
38
  {
39
- // Gunakan Ultra Low (0.05f) agar m_DataSize kecil seperti Crgh_3
40
  SimplifyAndEmbed(go, path);
41
 
42
- string fileName = Path.GetFileName(path);
43
- string exportPath = Path.Combine(EXPORT_DIR, fileName);
44
  PrefabUtility.SaveAsPrefabAsset(go, exportPath);
45
  PrefabUtility.UnloadPrefabContents(go);
46
- Debug.Log($"โœ… [EMBEDDED] {fileName}");
47
  }
48
  }
49
 
50
  AssetDatabase.SaveAssets();
51
  AssetDatabase.Refresh();
52
 
53
- // Jalankan Build AssetBundle (Biner Android untuk ZEPETO)
54
  BuildZepetoBundle();
55
 
56
- Debug.Log("๐Ÿš€ [UNITY] Proses selesai. Menyerahkan packing ke Python.");
57
  EditorApplication.Exit(0);
58
  }
59
  catch (Exception e)
60
  {
61
- Debug.LogError($"๐Ÿ’€ [FATAL] {e.Message}\n{e.StackTrace}");
62
  EditorApplication.Exit(1);
63
  }
64
  }
@@ -72,9 +65,7 @@ public class TestBuilder
72
  var renderers = go.GetComponentsInChildren<Renderer>();
73
  foreach (var ren in renderers)
74
  {
75
- Mesh sourceMesh = null;
76
- if (ren is MeshRenderer mr) sourceMesh = ren.GetComponent<MeshFilter>()?.sharedMesh;
77
- else if (ren is SkinnedMeshRenderer smr) sourceMesh = smr.sharedMesh;
78
 
79
  if (sourceMesh != null)
80
  {
@@ -85,7 +76,6 @@ public class TestBuilder
85
 
86
  Mesh newMesh = simplifier.ToMesh();
87
  newMesh.name = sourceMesh.name + "_Internal";
88
-
89
  AssetDatabase.AddObjectToAsset(newMesh, prefabPath);
90
 
91
  if (ren is MeshRenderer) ren.GetComponent<MeshFilter>().sharedMesh = newMesh;
 
18
  Debug.Log("๐Ÿ› ๏ธ [ZEPETO] Memulai optimasi mesh standar 2020...");
19
  AssetDatabase.Refresh();
20
 
 
21
  if (Directory.Exists(EXPORT_DIR)) Directory.Delete(EXPORT_DIR, true);
22
  if (Directory.Exists(BUNDLE_DIR)) Directory.Delete(BUNDLE_DIR, true);
23
  Directory.CreateDirectory(EXPORT_DIR);
 
25
 
26
  string[] prefabPaths = Directory.GetFiles("Assets/InputRaw", "*.prefab", SearchOption.AllDirectories);
27
 
 
 
 
 
 
28
  foreach (string path in prefabPaths)
29
  {
30
  GameObject go = PrefabUtility.LoadPrefabContents(path);
31
  if (go != null)
32
  {
33
+ // Ultra Low Quality (0.05f) agar m_DataSize kecil
34
  SimplifyAndEmbed(go, path);
35
 
36
+ string exportPath = Path.Combine(EXPORT_DIR, Path.GetFileName(path));
 
37
  PrefabUtility.SaveAsPrefabAsset(go, exportPath);
38
  PrefabUtility.UnloadPrefabContents(go);
39
+ Debug.Log($"โœ… [EMBEDDED] {Path.GetFileName(path)}");
40
  }
41
  }
42
 
43
  AssetDatabase.SaveAssets();
44
  AssetDatabase.Refresh();
45
 
46
+ // Build AssetBundle Android
47
  BuildZepetoBundle();
48
 
49
+ Debug.Log("๐Ÿš€ [UNITY] Selesai. Menyerahkan tugas packing ke Python.");
50
  EditorApplication.Exit(0);
51
  }
52
  catch (Exception e)
53
  {
54
+ Debug.LogError($"๐Ÿ’€ [FATAL] {e.Message}");
55
  EditorApplication.Exit(1);
56
  }
57
  }
 
65
  var renderers = go.GetComponentsInChildren<Renderer>();
66
  foreach (var ren in renderers)
67
  {
68
+ Mesh sourceMesh = (ren is MeshRenderer mr) ? ren.GetComponent<MeshFilter>()?.sharedMesh : (ren is SkinnedMeshRenderer smr) ? smr.sharedMesh : null;
 
 
69
 
70
  if (sourceMesh != null)
71
  {
 
76
 
77
  Mesh newMesh = simplifier.ToMesh();
78
  newMesh.name = sourceMesh.name + "_Internal";
 
79
  AssetDatabase.AddObjectToAsset(newMesh, prefabPath);
80
 
81
  if (ren is MeshRenderer) ren.GetComponent<MeshFilter>().sharedMesh = newMesh;