void CreateAssetBundlesFromScene() { BuildHelper.CreateAssetBundlesFromScene(); }
public override void DidMergeWorld() { EditorUtility.DisplayProgressBar("Cleaning up", "Combining GameObjects", 0.0f); //put all of the global data under "Global level data" GameObject global_data = new GameObject("Global Level Data"); global_data.AddComponent <AssetBundleHelper> (); string[] objects_to_delete = { "Main Camera" }; for (int i = 0; i < objects_to_delete.Length; i++) { GameObject to_delete = GameObject.Find(objects_to_delete [i]); if (to_delete != null) { GameObject.DestroyImmediate(to_delete); } } string[] objects_to_parent = { "WorldPainterData", "RenderSettings", "LightProbes" }; for (int i = 0; i < objects_to_parent.Length; i++) { GameObject to_delete = GameObject.Find(objects_to_parent [i]); if (to_delete != null) { to_delete.transform.parent = global_data.transform; } } //Create Prefabs & Generate Assetbundles EditorUtility.DisplayProgressBar("Cleaning up", "Creating Prefabs & Assetbundles", 0.6f); BuildHelper.CreateAssetBundlesFromScene(); //Deploy? /*EditorUtility.DisplayProgressBar("Cleaning up", "Removing Empty GameObjects and Empty Meshes", 0.0f); * KillLighting(); * EditorUtility.DisplayProgressBar("Cleaning up", "Removing Empty GameObjects and Empty Meshes", 0.25f); * KillExtraneousObjects(); * EditorUtility.DisplayProgressBar("Cleaning up", "Removing Empty GameObjects and Empty Meshes", 0.5f); * RemoveEmptyAnims(); * EditorUtility.DisplayProgressBar("Cleaning up", "Removing Empty GameObjects and Empty Meshes", 0.75f); * * List<MeshFilter> filtersList = new List<MeshFilter>(); * List<Transform> transforms = new List<Transform>(); * List<GameObject> z_unmerged_gameObjects = new List<GameObject>(); * * foreach(KeyValuePair<string,GameObject> piece in blockCodesMapping) * { * var prefab = piece.Value; * if (!prefab) * { * Debug.LogError("No prefab for code " + prefab.name); * continue; * } * * var unmerged = EB.Util.GetObjectExactMatch(prefab,"z_unmerged"); * if (!unmerged) * { * Debug.LogError("No z_unmerged found in prefab " + prefab.name + ". Not merging this block."); * continue; * } * * z_unmerged_gameObjects.Add(unmerged as GameObject); * * var meshFilters = EB.Util.FindAllComponents<MeshFilter>(unmerged); * * filtersList.AddRange(meshFilters); * transforms.AddRange(EB.Util.FindAllComponents<Transform>(unmerged)); * * } * * //skip hidden meshes * for (int i = filtersList.Count - 1; i >= 0; --i) * { * MeshFilter filter = filtersList[i]; * if (!filter.gameObject.activeInHierarchy) * { * filtersList.RemoveAt(i); * } * } * * var filters = filtersList.ToArray(); * * int childDepth = 5; * for (int i = 0; i < childDepth; ++i) * { * foreach(var filter in filters) * { * if (filter == null) * continue; * * int childCount = filter.gameObject.transform.childCount; * Component[] components = filter.gameObject.GetComponents<Component>(); * * if ((childCount == 0) && (components.Length == 4) && (filter.gameObject.GetComponents<Building>().Length == 1)) * { * //a transform, or a transform, mesh filter, mesh renderer (which we merged), and a building script; so kill the parent node * DestroyImmediate(filter.gameObject); * } * } * * foreach(var transform in transforms) * { * if (transform.gameObject.name == "Front" || transform.gameObject.name == "Back") * continue; * } * } * * for (int i = 0; i < z_unmerged_gameObjects.Count; i++) * { * RemoveEmptyGameObjects(z_unmerged_gameObjects[i]); * } * * Object.DestroyImmediate( GameObject.Find("Main Camera") ); * EditorUtility.ClearProgressBar();*/ }