public void OnPostGenerateGradleAndroidProject(string path) { // Check if it's trying to build to an unsuportted platform if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android) { // Plugin might be on a project that's not making use of it. So we'll just show a warning. Debug.LogWarning($"<size=20>Kiln only supports Android for the moment.</size>"); return; } else { Settings settings = Resources.Load <Settings>("KilnSettings"); // If we do have a kiln configuration we'll copy that configuration to the Android Build if (settings != null) { string assetsPath = $"{path}/src/main/assets"; string file; // Copy the mocked leaderboard status foreach (Settings.Leaderboard l in settings.Leaderboards) { if (Leaderboard.IsSaved(l.Id)) { file = $"{assetsPath}/{Leaderboard.GetFileName(l.Id)}"; if (settings.ExportLeaderboardState) { System.IO.File.Copy(Leaderboard.GetPath(l.Id), file, true); } else { // If we don't want to export our current Leaderboard states // we'll just create new ones Leaderboard aux = new Leaderboard(l.Id, 100, l.Type, false); System.IO.File.WriteAllText(file, aux.ToJson()); } } } // Copy the mocked In App Purchases status file = $"{assetsPath}/{InAppPurchases.StorageFileName}"; if (InAppPurchases.IsSaved() && settings.ExportIAPState) { System.IO.File.Copy(InAppPurchases.StoragePath, file, true); } else { System.IO.File.WriteAllText(file, InAppPurchases.GetEmptyState()); } // Create kiln definitions var definitions = new KilnDefinition(settings); file = $"{assetsPath}/{KilnDefinition.FileName}"; System.IO.File.WriteAllText(file, definitions.Serialize().ToString()); } } }