diff --git a/Assets/Editor/BuildProcessor.meta b/Assets/Editor/BuildProcessor.meta new file mode 100644 index 0000000..8fe21ea --- /dev/null +++ b/Assets/Editor/BuildProcessor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a1aaa26d5f45844428c22d82e25da77c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/BuildProcessor/LanguageFileProcessor.cs b/Assets/Editor/BuildProcessor/LanguageFileProcessor.cs new file mode 100644 index 0000000..cd69d38 --- /dev/null +++ b/Assets/Editor/BuildProcessor/LanguageFileProcessor.cs @@ -0,0 +1,51 @@ +using System.IO; +using UnityEngine; +using UnityEditor.Build; +using UnityEditor.Build.Reporting; + +public class LanguageFileProcessor : IPostprocessBuildWithReport +{ + public void OnPostprocessBuild(BuildReport report) + { + var directoryPath = Application.dataPath + "/Languages"; + var outputPath = report.summary.outputPath; + var nextPath = Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_data/Languages"; + + Debug.Log("Copy" + directoryPath + "To" + nextPath); + + CopyDirectory(directoryPath, nextPath); + + var metaFiles = Directory.GetFiles(nextPath, "*.meta", SearchOption.AllDirectories); + foreach (var item in metaFiles) + File.Delete(item); + } + + // 実行順 + public int callbackOrder { get { return 0; } } + + + static void CopyDirectory(string sourceDirectoryName, string targetDirectoryName) + { + DirectoryInfo source = new DirectoryInfo(sourceDirectoryName); + + if (!source.Exists) + return; + + if (!Directory.Exists(targetDirectoryName)) + Directory.CreateDirectory(targetDirectoryName); + + FileInfo[] files = source.GetFiles(); + foreach (FileInfo file in files) + { + string temppath = Path.Combine(targetDirectoryName, file.Name); + file.CopyTo(temppath, false); + } + + DirectoryInfo[] subDirectories = source.GetDirectories(); + foreach (DirectoryInfo subDirectory in subDirectories) + { + string temppath = Path.Combine(targetDirectoryName, subDirectory.Name); + CopyDirectory(subDirectory.FullName, temppath); + } + } +} diff --git a/Assets/Editor/BuildProcessor/LanguageFileProcessor.cs.meta b/Assets/Editor/BuildProcessor/LanguageFileProcessor.cs.meta new file mode 100644 index 0000000..e73ae40 --- /dev/null +++ b/Assets/Editor/BuildProcessor/LanguageFileProcessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba986e7565763994683427f74c98a0b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: