public static void BuildGameData() { Debug.Log("GameDataBuilder (BuildGameData) :: Building game data"); string processGameDBPath = BinaryDataPath; string json = JSONMinifyTool.Minify(File.ReadAllText(GameDataImporter.GameDBJsonPath)); byte[] encrypted = GameDataUtils.EncryptGameData(json, Encoding.Default); if (encrypted != null) { using (FileStream fs = new FileStream(processGameDBPath, FileMode.Create, FileAccess.Write)) { using (MemoryStream ms = new MemoryStream()) { ms.Write(encrypted, 0, encrypted.Length); ms.WriteTo(fs); } } } else { throw new Exception("Cannot encrypt gameDB! Failing the build."); } AssetDatabase.Refresh(); }