/* * Parse Fx meshes from AssetBundle */ private IEnumerator ParseFx(AbstractFXMesh mesh, Action <GameObject[]> callback) { TextAsset targetFile = Resources.Load <TextAsset>("assetBundleInfo"); GameObject[] meshObjects = null; BundleMap map = JsonUtility.FromJson <BundleMap>(targetFile.text); foreach (var raceInfo in map.races) { if (raceInfo.race.Equals(mesh.CharacterRace)) { foreach (var meshInfo in raceInfo.fxs) { if (meshInfo.type.Equals(mesh.FxType)) { meshObjects = new GameObject[meshInfo.meshPaths.Count]; int i = 0; foreach (var meshPathInfo in meshInfo.meshPaths) { yield return(LoadMeshCoroutine(meshPathInfo.path, (GameObject meshGameObject) => { meshObjects[i] = meshGameObject; })); i++; } } } } } callback.Invoke(meshObjects); }
public void ParseMeshes(AbstractFXMesh mesh, Action <GameObject[]> callback) { var objects = AssetDatabase.FindAssets("t:GameObject", new string[] { mesh.GetFolderPath() } ); var meshObjects = new GameObject[objects.Length]; for (int i = 0; i < objects.Length; i++) { meshObjects[i] = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(objects[i]), typeof(GameObject)) as GameObject; } callback.Invoke(meshObjects); }
public void ParseMeshes(AbstractFXMesh mesh, Action <GameObject[]> callback) { StartCoroutine(ParseFx(mesh, callback)); }