public void OnShareButtonClick() { using (var payload = new SharePayload("NatCamWithOpenCVForUnityExample", completionHandler: () => { Debug.Log("User shared image!"); } )) { payload.AddText("User shared image!"); payload.AddImage(texture); } }
/// <summary> /// Raises the share button click event. /// </summary> public async void OnShareButtonClick() { Debug.Log("OnShareButtonClick ()"); if (isVideoPlaying || isVideoRecording || isFinishWriting || string.IsNullOrEmpty(videoPath)) { return; } var mes = ""; #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR try { SharePayload payload = new SharePayload(); payload.AddText("User shared video! [NatCorderWithOpenCVForUnity Example](" + NatCorderWithOpenCVForUnityExample.GetNatCorderVersion() + ")"); payload.AddMedia(videoPath); var success = await payload.Commit(); mes = $"Successfully shared items: {success}"; } catch (ApplicationException e) { mes = e.Message; } #else mes = "NatShare Error: SharePayload is not supported on this platform."; await Task.Delay(100); #endif Debug.Log(mes); if (fpsMonitor != null) { fpsMonitor.Toast(mes); } }