public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); serializedObject.Update(); Element2DCreate ele = target as Element2DCreate; if (GUILayout.Button("Clear All AssetBundle")) { AssetBundle.UnloadAllAssetBundles(true); ElementAsset.bundles.Clear(); EditorModelManager2D.Clear(); } if (GUILayout.Button("Create")) { Create(ele.Assetname, ele.dicpath, ele.gameObject); } if (GUILayout.Button("Clone")) { if (ele.bytesUI != null) { Clone(ele.Assetsname, ele.CloneName, ele.bytesUI.bytes, ele.transform); } } if (GUILayout.Button("CloneAll")) { if (ele.bytesUI != null) { CloneAll(ele.bytesUI.bytes, ele.transform); } } serializedObject.ApplyModifiedProperties(); }
static void CloneAll(byte[] ui, Transform root) { if (ui != null) { LoadBundle(); ModelManager2D.Initial(); var all = ModelManager2D.LoadModels(ui, "assTest"); var models = all.models.child; for (int i = 0; i < models.Count; i++) { EditorModelManager2D.LoadToGame(models[i], null, root, ""); } } }
static void Clone(string Assetsname, string CloneName, byte[] ui, Transform root) { if (ui != null) { if (Assetsname != null) { if (CloneName != null) { if (CloneName != "") { LoadBundle(); ModelManager2D.Initial(); ModelManager2D.LoadModels(ui, "assTest"); EditorModelManager2D.LoadToGame(Assetsname, CloneName, null, root, ""); } } } } }