public static void ExportExchangeSequence() { UnityEngine.Object[] objs = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets); if (objs == null || objs.Length == 0) { Debug.LogError("no sequence selected"); return; } BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget; string exportPath = SequenceEditorUtils.PlatformPath(buildTarget); if (exportPath == null) { Debug.LogError("get export path error"); return; } exportPath += "Sequence/"; if (!Directory.Exists(exportPath)) { Directory.CreateDirectory(exportPath); } for (int m = 0, mcount = objs.Length; m < mcount; m++) { UnityEngine.Object obj = objs[m]; GameObject go = (GameObject)UnityEngine.Object.Instantiate(obj); go.name = obj.name; Cutscene sequencer = go.GetComponent <Cutscene>(); MovieData moviedata = go.GetComponent <MovieData>(); if (sequencer == null) { Debug.LogError("target is not sequence->" + go.name); return; } if (moviedata == null) { Debug.LogError("moviedata is null->" + go.name); return; } CheckOut(moviedata); } }
public static void ExportSequenceObj(UnityEngine.Object[] objs) { if (objs == null || objs.Length == 0) { Debug.LogError("no sequence selected"); return; } BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget; string exportPath = SequenceEditorUtils.PlatformPath(buildTarget); if (exportPath == null) { Debug.LogError("get export path error"); return; } exportPath += "Sequence/"; if (!Directory.Exists(exportPath)) { Directory.CreateDirectory(exportPath); } for (int m = 0, mcount = objs.Length; m < mcount; m++) { UnityEngine.Object obj = objs[m]; GameObject go = (GameObject)UnityEngine.Object.Instantiate(obj); Cutscene sequencer = go.GetComponent <Cutscene>(); MovieData moviedata = go.GetComponent <MovieData>(); if (sequencer == null) { Debug.LogError("target is not sequence->" + go.name); return; } string name = go.name; int index = name.IndexOf("("); if (index >= 0) { name = name.Substring(0, index); } SequenceData data = go.AddComponent <SequenceData>(); data.cutscene = sequencer; data.moviedata = moviedata; data.Cameras = go.GetComponentsInChildren <Camera>(); for (int j = 0; j < data.Cameras.Length; j++) { if (data.Cameras[j].name == "Main Camera") { data.mainindex = j; } } UnityEngine.Object prefab = SequenceEditorUtils.GetPrefab(go, name); UnityEngine.Object.DestroyImmediate(go); BuildPipeline.BuildAssetBundle(prefab, null, exportPath + prefab.name, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, buildTarget); } }