static void ShareAllLogs(string logs) { // Android intent limit size is 1MB (https://stackoverflow.com/questions/39098590) // Thus we save it as a file then share the file instead string fileName = string.Format("{0}_{1}({2})_{3}.log", Application.productName, Application.version, EventBridge.AppVersionCode, DateTime.Now.ToString("MMMM-dd_HH-mm-ss-ff")); string folderPath = Path.Combine(Application.persistentDataPath, "MCK_Logs"); string filePath = Path.Combine(folderPath, fileName); // Make sure the directory is created Directory.CreateDirectory(folderPath); File.WriteAllText(filePath, logs); #if UNITY_EDITOR || UNITY_STANDALONE if (LogConsoleSettings.Instance.useShareLogViaMail) { ShareLogToEmailClient(logs); } #elif UNITY_IOS || UNITY_ANDROID NativeShare.ShareMultiple("", new string[] { filePath }); #endif #if UNITY_EDITOR Debug.LogFormat("Logs are saved at: {0}\n You can quickly open the log folder by <b>Tools > Mobile Console > Open Log Folder </b>", filePath); #endif }
static void ShareFiles(string[] filePaths) { if (filePaths == null || filePaths.Length == 0) { return; } NativeShare.ShareMultiple("", filePaths); }
void ShareAllFiles(GenericNodeView nodeView) { if (_filePaths == null) { _filePaths = Directory.GetFiles(Application.persistentDataPath, "*", SearchOption.AllDirectories); } if (_filePaths.Length > 0) { NativeShare.ShareMultiple("", _filePaths); } }