Search Unity

NatShare - Free Sharing API

Discussion in 'Assets and Asset Store' started by Lanre, Apr 17, 2018.

  1. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    artofmining likes this.
  2. Rich0

    Rich0

    Joined:
    Aug 9, 2013
    Posts:
    43
    Wonderful! Thank you!
     
  3. Rich0

    Rich0

    Joined:
    Aug 9, 2013
    Posts:
    43
    Hi Lanre,

    Instagram works fine with ShareMedia - however Twitter does not appear. Is it possible to share videos to Twitter via ShareMedia?
     
  4. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Whether or not an app can receive media to be shared is determined by that app, so when an app doesn't pop up as a sharing option, it might be that the app doesn't support that kind of sharing. I opened the photos app on my iPhone and tried to share a video and Twitter wasn't in the options. So it would seem that Twitter doesn't support receiving videos to be shared.
     
  5. Baruch-B

    Baruch-B

    Joined:
    Mar 25, 2014
    Posts:
    3
    Hi
    I want to create a simple button for sharing the video file that is saved to the camera roll.when I add "NatShare.ShareMedia(path)" under the on replay It works fine but It popups immediately.What I like to do is a different button for sharing and saving the recorded video...any suggestions? Thanks
     
  6. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    239
    I tried the native share plugin to share text and only text. but plugin adds a request for photo/media permission in the manifest. how can I disable that?
     
  7. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    You can use the ShareMedia function for sharing and SaveToCameraRoll function for saving to the camera roll. I'm not sure what you are asking.
     
  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    There is no way to remove these permissions from NatShare. You can try 'hacking' it by building a Gradle project from Unity, then removing the permissions from the generated project's manifest before compiling an APK from the gradle project.
     
  9. pedroulhoa

    pedroulhoa

    Joined:
    Jul 12, 2018
    Posts:
    2
    Hello, I'm trying to use NatShare to share an mp3 file that is in my project, but the share button does not return anything, what path should I put in the path variable? I am using the following code:

    string videoPath = ...;
    NatShare.ShareMedia (videoPath);
     
  10. mintyfreshdev

    mintyfreshdev

    Joined:
    Feb 10, 2017
    Posts:
    1
    Hi! I am having some issues using NatShare to save to the camera roll on Android. I'm up to date with NatShare 1.1.

    In my project, I have a button that will take a picture (a simple Texture2D screenshot) when tapped, or record a video when held down (using NatCorder).

    I've been using this code to debug saving images to the camera roll (and basically the same for video as well):

    Code (CSharp):
    1.             bool photoSaveTest = NatShare.SaveToCameraRoll(photoTexture);
    2.             if (!photoSaveTest)
    3.             {
    4.                 Debug.Log("NatShare Debug: Photo Save to Camera Roll Failed");
    5.             }
    6.             else
    7.             {
    8.                 Debug.Log("NatShare Debug: Photo Save to Camera Roll Succeeded");
    9.             }
    When I press my "Save to Camera Roll" button when trying to save an image, nothing happens. I don't get either debug message.
    When I press my "Save to Camera Roll" button when trying to save a video, the console shows "NatShare Debug: Video Save to Camera Roll Failed" immediately.

    Native sharing is working (somewhat) - if I choose "Upload to Photos" from the Android native sharing dialog (this is for both photo and video), it'll say "Error, could not upload media" shortly after. But I can send things to myself on Slack just fine.

    Any help you can give me would be highly appreciated, thanks in advance. If you need to see more of my code just let me know.

    Also, for what it's worth, I'm using a Google Pixel XL.
     
  11. MrTroyD

    MrTroyD

    Joined:
    Mar 5, 2015
    Posts:
    4
    I've run in to the same exact problem as the above commented. I've checked my manifest multiple times, and I believe the read and write permissions are set properly. It will allow me to save using the share(But this is undesirable). Attempting to use the Save to Camera Roll feature only gives me an error.
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    What platform are you running on? What is your sharing path exactly?
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Check that your button is set to invoke your function when it is pressed. This is the only explanation for neither message being logged (it's an if-else).
    Can you upload the full logs from logcat as a .txt? That will likely have the reason for the failure.
    If Slack works, but Upload to Photos doesn't, then it is likely not because of NatShare. In any case, the logs should provide more information.
     
  14. pedroulhoa

    pedroulhoa

    Joined:
    Jul 12, 2018
    Posts:
    2
    I'm testing on Android, path sharing I'm using System.IO.Path.Combine (Application.streamingAssetsPath, "video.mp4"), where I place the file in the StreamingAssets folder.
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    On Android, StreamingAssets files are kept inside a jar archive. NatShare only supports sharing plain files, so you would have to first extract the file from the jar archive before NatShare can work on it. This project can be useful.
     
  16. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    765
    Hello guys,

    Does this asset requieres NatCorder and NatCam? or either?

    Regards,
    Carlos
     
  17. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    239
    @Lanre
    When composing an email, is it possible to add a subject field?
     
  18. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Not at all. NatShare is an independent package.
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    I presume you mean when using the ShareText function. This is not possible.
     
  20. MrTroyD

    MrTroyD

    Joined:
    Mar 5, 2015
    Posts:
    4
    This is the error I'm getting. I have read and write permissions set in my manifest. I also use File.IO elsewhere in the project. I only get this error when I call NatShare.SaveToCameraRoll after recording a video with NatCorder. Screen Shot 2018-09-10 at 1.01.33 PM.png
     
  21. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    What device and OS version are you running on? Can you upload the full logs from logcat in an attachment? If you are running on Android 23+, you need to manually allow these permissions on the device (not just statically defining them in the manifest).
     
  22. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    765
    Hello again,

    I may not have frame the question correctly. My apologies. What I mean is: Does this asset contains the necessary tools/assets to record gameplay video and then share it, or does require another asset for the recording of the gameplay video?

    Regards,
    Carlos
     
  23. MrTroyD

    MrTroyD

    Joined:
    Mar 5, 2015
    Posts:
    4
    Found that, that was the source of the problem. Another plugin was disabling the ability to prompt (android.permissions.WRITE_EXTERNAL_STORAGE) as well as disabling it even though it was in the Manifest.
     
  24. MrTroyD

    MrTroyD

    Joined:
    Mar 5, 2015
    Posts:
    4
    You want NatCorder to record gameplay.
     
    Lanre likes this.
  25. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    NatShare is only for sharing files and saving to the camera roll. It doesn't handle things like video recording (NatCorder) or camera usage (NatCam).
     
  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Good catch!
     
  27. sgt3v

    sgt3v

    Joined:
    Feb 19, 2017
    Posts:
    17
    Hi Lanre,

    Firstly NatCorder and NatShare both are great assets thank you for the great job, especially NatCorder helped me immensely.

    I have a question about NatShare, I want to move the recorded video to cam roll yet it returns false. I have
    write permisson: external
    . What would be the cause of this?
     
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Can you share the full logs from logcat? I'm not sure what the issue could be stemming from.
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    I'll look into this. Does this happen on iOS or Android?
     
  30. yCatDev

    yCatDev

    Joined:
    Jun 17, 2017
    Posts:
    18
    Looks like is not your issue. I try another plugins and understood two things. First it that NatShare the best in this catagory of plugins and second all plugins have long time for opening share menu. So maybe our app is too heavy for mobile platforms.
     
  31. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Okay this sounds good. I'll still see if there's anything I can do to improve it on my end.
     
  32. Naani1

    Naani1

    Joined:
    Aug 17, 2018
    Posts:
    1
    Hello Guys Anyone Can Guide me To take a screenshot as a texture 2d to share it
     
  33. abhayaagrawal

    abhayaagrawal

    Joined:
    Sep 30, 2016
    Posts:
    7
    I am facing issue while sharing video over Skype. However it work's fine with other apps.
    While sharing video on Skype over Andorid platform it shares video not text
    and while sharing on Skype over iOS platform it shares text not video
     
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    I responded on GitHub. This is entirely up to the receiving app (in this case, Skype). The receiving app decides what parts of the sharing payload it accepts.
     
  36. dbhf

    dbhf

    Joined:
    May 1, 2015
    Posts:
    2
    Hello guys, I am struggling with my android app, I am using ARCore and target device is 8.0, I am getting this error
    10-02 12:42:37.867: E/Unity(18522): NatShare Error: Failed to copy media to camera roll when trying to save to camera roll, the only bit I modified was this, I updated both NatShare to 1.1 and NatCorder, help very much appreciated as I don't understand why this can't be copied, I already tried to change my bundle name and max lenght of the path I achieved is 82 characters, but still getting the same error,

    Code (CSharp):
    1. void OnReplay(string path)
    2.         {
    3.             Debug.Log("Saved recording to: " + path);
    4.             // Playback the video
    5. #if UNITY_IOS
    6.             Handheld.PlayFullScreenMovie("file://" + path);
    7. #elif UNITY_ANDROID
    8.             NatShare.SaveToCameraRoll(path);
    9.             //Handheld.PlayFullScreenMovie(path);
    10. #endif
    11.         }
    I also tried to rename the file, I don not get the error but when I go to gallery there are no videos there
    Code (CSharp):
    1. var newFilename = DateTime.Now.ToString("yyyyMMddhhmmss");
    2. var originalPathNewFilename = newPath.Parent.FullName + "/" + newFilename + ".mp4";
    3. #elif UNITY_ANDROID
    4.             NatShare.SaveToCameraRoll(originalPathNewFilename);          
    5. #endif
    6.  
    Thank you very much, looking forward to get support
     
    Last edited: Oct 2, 2018
  37. Hellium

    Hellium

    Joined:
    Sep 25, 2014
    Posts:
    29
    @Lanre ,

    Hello,

    Like many other people here, I would like to thank you for the assets you have created. I have bought NatCorder, and I want now to share the captured videos with NatShare.

    Everything works fine on Android with Facebook, Instagram, mail, but Twitter does not seem to accept any media I provide (pictures nor videos). The application is proposed in the native share sheet and sharing another video located in the gallery does work.

    I have tested with two different Android devices. I don't get anything related to NatShare in the logs of Logcat. The Write Permissions is set to External. Have you any clue about the origin of the problem?

    I would like to do the following test: copy the saved video into the camera roll (using NatShare.SaveToCameraRoll( filePath ) and share the moved / copied file using
    NatShare.ShareMedia( cameraRollFilePath ) but I don't see how I could retrieve the path of the moved / copied file.

    Thanks in advance, and have a nice day! (And again, thanks for your assets :) )
     
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Can you attach the full logs from logcat (don't filter for Unity tags). The cause for the exception are in the logs.
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Hey there. I'm not sure what's going on here, but I'll look into it. NatShare doesn't give you the path of the image in the camera roll because such a path doesn't exist on a different platform like iOS.

    EDIT: Can you upload the full logs (no Unity tag filtering) here? It might contain relevant information about the failure.
     
  40. Hellium

    Hellium

    Joined:
    Sep 25, 2014
    Posts:
    29
    @Lanre:

    Because the log is more than 5000k lines long, I don't think you will have the courage to read it all. But I saw the following lines that could give you a clue:

    https://pastebin.com/WuBiTKg0

    Note: I found another game able to share an image on Twitter, so I don't think the problem comes from Twitter... o_O
     
    Last edited: Oct 3, 2018
  41. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    I can look through the full logs; the logs you shared have no mention of NatShare. What Android version is your device using?
     
  42. Hellium

    Hellium

    Joined:
    Sep 25, 2014
    Posts:
    29
    Hello @Lanre

    I got you a new log file, not filtered this time, containing the lines from the moment I started recording (using your NatCorder plugin) until the Twitter application started.

    https://pastebin.com/b4ers9Un

    My device uses Android 7.0.

    For an unexplainable reason, the share to Twitter on Android 7.1 worked today. I did not change the game nor recompile it. I thought it was thanks to a reboot, but it did not work on the 1st device after a reboot.
     
  43. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    The logs don't seem to indicate any problems in NatShare. As a result, I don't know that there is anything that can be done on our end to resolve this.
     
  44. Hellium

    Hellium

    Joined:
    Sep 25, 2014
    Posts:
    29
    @Lanre: I understand, thanks anyway for your consideration. I will test on other devices to see if I can reproduce the problem. Have a nice day!
     
    Lanre likes this.
  45. Hellium

    Hellium

    Joined:
    Sep 25, 2014
    Posts:
    29
    Hello @Lanre,

    It's me again... I did not take the time to solve the problem on my Android device. But I tested on an iOS one and I have several issues:
    1. The share view takes a lot of time to appear, and may even fail because of a timeout. I have to run the share twice
    2. The NatShare.ShareMedia function returns true before the share view appear
    3. The instagram share fails
    Here is the log of Xcode:

    Code (CSharp):
    1. NatCorder: Prepared MP4 video encoder at resolution 720x960@15Hz with average bitrate 1048576 and keyframe interval 2s
    2.  
    3. NatCorder: MP4 recorder started recording
    4.  
    5. WARNING -> applicationDidReceiveMemoryWarning()
    6.  
    7. NatCorder: MP4 Encoder detected EOS marker
    8.  
    9. NatCorder: MP4 recorder finishing
    10.  
    11. Media shared
    12.  
    13. MediaSharer:Share(String)
    14.  
    15. UnityEngine.Events.UnityEvent`1:Invoke(T0)
    16.  
    17. NatCamU.Dispatch.MainDispatch:Update()
    18.  
    19. NatCamU.Dispatch.<OnFrame>c__Iterator0:MoveNext()
    20.  
    21. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    22.  
    23.  
    24.  
    25. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    26.  
    27.  
    28.  
    29. [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
    30.  
    31. [MC] Reading from public effective user settings.
    32.  
    33. [MC] Filtering mail sheet accounts for bundle ID: com.Company.ProductName, source account management: 1
    34.  
    35. [MC] Filtering mail sheet accounts for bundle ID: com.Company.ProductName, source account management: 2
    36.  
    37. [MC] Filtering mail sheet accounts for bundle ID: com.Company.ProductName, source account management: 1
    38.  
    39. [MC] Filtering mail sheet accounts for bundle ID: com.Company.ProductName, source account management: 2
    40.  
    41. [ShareSheet] ERROR: <UIActivityViewController: 0x10c2a3000> timed out waiting to establish a connection to the ShareUI view service extension.
    42.  
    43. [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
    44.  
    45. NatCorder: Prepared MP4 video encoder at resolution 720x960@15Hz with average bitrate 1048576 and keyframe interval 2s
    46.  
    47. NatCorder: MP4 recorder started recording
    48.  
    49. NatCorder: MP4 Encoder detected EOS marker
    50.  
    51. NatCorder: MP4 recorder finishing
    52.  
    53. Media shared
    54.  
    55. MediaSharer:Share(String)
    56.  
    57. UnityEngine.Events.UnityEvent`1:Invoke(T0)
    58.  
    59. NatCamU.Dispatch.MainDispatch:Update()
    60.  
    61. NatCamU.Dispatch.<OnFrame>c__Iterator0:MoveNext()
    62.  
    63. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    64.  
    65.  
    66. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    67.  
    68.  
    69. [MC] Filtering mail sheet accounts for bundle ID: com.Company.ProductName, source account management: 1
    70.  
    71. [MC] Filtering mail sheet accounts for bundle ID: com.Company.ProductName, source account management: 2
    72.  
    73. [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
    74.  
    75. [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
    76.  
    77. [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
    78.  
    79. [default] [ERROR] Could not create a bookmark: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.}
    80.  
    81. [default] [ERROR] Failed to determine whether URL /var/mobile/Containers/Data/Application/XXXXXX/Documents/recording_2018_10_10_16_04_13_208.mov (n) is managed by a file provider
     
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    What device and iOS version are you running on? The `ShareMedia` function should not take any time, given that all it does is hand over the file URL to iOS's UIActivityViewController.
    This is expected behaviour. NatShare doesn't support callbacks for after the share activity is completed.
    I'll look into this.
     
  47. Hellium

    Hellium

    Joined:
    Sep 25, 2014
    Posts:
    29
    My iOS device (iPad mini 3) runs on iOS 11.3.1. I can upgrade it to iOS 12.0.1, and I guess I will have to....

    Yes, that's what I saw when I dug into the code and saw the issue on Github, but I thought the native function would return after providing the share possibilities.

    Thanks a lot. I have to mention that the Instagram application has the rights to access the files since I am able to publish the recorded video from the Instagram app itself.
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Not at all. Sharing functions are asynchronous by nature (the user can take as much time deliberating on where to share as they want).
     
  49. PotatoMasha

    PotatoMasha

    Joined:
    Jun 13, 2015
    Posts:
    2
    Hello,

    I downloaded your plugin to share images in Android. I can run it fine in the editor and it gives me the platform does not support sharing error which is normal, but when I try to build it to android I get the following build errors:

    Exception: Unknown CPU architecture for library Assets/NatShare-API-1.1/Assets/NatShare/Plugins/iOS/libNatShare.a
    UnityEditor.Android.PostProcessor.Tasks.NativePlugins.ProcessPlugin (UnityEditor.Android.PostProcessor.PostProcessorContext context, System.String pluginPath, System.String pluginTargetCPU)
    UnityEditor.Android.PostProcessor.Tasks.NativePlugins.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:287)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()


    Error building Player: 2 errors

    UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:187
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:94
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()


    In my c# script I just have the "using NatShareU;" at the top and "NatShare.ShareImage(texture);" later down with a texture2D passed to it.

    I suspect that it is an android manifest error but I have found no documentation telling me to change the android manifest on the forums or GitHub. I also tried changing write permissions to external(SDCard) but no luck.

    Here is my c# script when I call NatShare:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using System.IO;
    6. using System;
    7. using NatShareU;
    8.  
    9. public class Screenshots : MonoBehaviour {
    10.  
    11.     [SerializeField]
    12.     private Image displayImage;
    13.     [SerializeField]
    14.     private SpriteRenderer displaySprite;
    15.    
    16.     public Text text;
    17.    
    18.     //create screenshot folder
    19.     void Start() {
    20.         if(!Directory.Exists(Application.persistentDataPath + "\\screenshots")) {
    21.             if(Application.isMobilePlatform) Directory.CreateDirectory(Application.persistentDataPath + "/screenshots");
    22.             else Directory.CreateDirectory(Application.persistentDataPath + "\\screenshots");
    23.         }
    24.     }
    25.    
    26.     //returns the image of a filename and location
    27.     void GetScreenshot(String filePath) {
    28.         print(filePath);
    29.         Texture2D texture = null;
    30.         byte[] fileBytes;
    31.         if (File.Exists (filePath)) {
    32.             fileBytes = File.ReadAllBytes (filePath);
    33.             texture = new Texture2D (2, 2, TextureFormat.RGB24, false);
    34.             texture.LoadImage (fileBytes);
    35.             if(displayImage) displayImage.sprite = Sprite.Create (texture, new Rect (0, 0, texture.width, texture.height), new Vector2 (0.5f, 0.5f));
    36.             else if(displaySprite) displaySprite.sprite = Sprite.Create (texture, new Rect (0, 0, texture.width, texture.height), new Vector2 (0.5f, 0.5f));
    37.            
    38.             NatShare.ShareImage(texture);
    39.         }
    40.     }
    41.    
    42.     public void Screenshot() {
    43.         StartCoroutine("IScreenshot");
    44.     }
    45.    
    46.     IEnumerator IScreenshot() {
    47.        
    48.         //capture after rendering
    49.         yield return new WaitForEndOfFrame();
    50.        
    51.         string timeStamp = DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss");
    52.         string pathToSave = "screenshots/Screenshot" + timeStamp + ".png";
    53.         if(!Application.isMobilePlatform) pathToSave = Application.persistentDataPath + "/screenshots/Screenshot" + timeStamp + ".png";
    54.         ScreenCapture.CaptureScreenshot(pathToSave); //supersize 2
    55.        
    56.         //wait until done saving
    57.         yield return new WaitForSecondsRealtime(0.3f);
    58.        
    59.         if(Application.isMobilePlatform) GetScreenshot(Application.persistentDataPath + "/" + pathToSave);
    60.         else GetScreenshot(pathToSave);
    61.     }
    62. }
    63.    
    64.    
     
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,780
    Navigate to libNatShare.a in the Editor, and in the Inspector, make sure that the plugin only applies to iOS and no other platform. Also, you seem to have downloaded the entire NatShare source project into your project. I recommend downloading the API from the Asset Store instead.
     
unityunity