Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

⭐ ULTIMATE SCREENSHOT CREATOR ⭐ - perfect for marketing and ingame screenshots

Discussion in 'Assets and Asset Store' started by WildMageGames, Mar 17, 2017.

  1. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello,

    There is currently no such feature in the asset.

    However, this could be made that way with a simple script:
    Create a script that reference a ScreenshotManager and your scroll rect, by creating a coroutine that will capture a screenshot, move the scrollrect, etc, until you reach the maximum scroll value.
     
  2. nastenke

    nastenke

    Joined:
    Mar 3, 2017
    Posts:
    5
    Hello, I have Crash in Google play looks like it's related to Screenshot plugin, because NativeShare is a part of it.
    How to fix it?

    Crash details
    java.lang.Error
    com.yasirkula.unity.NativeShareBroadcastListener.Initialize

    java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 2020.3.31f1
    Device model : motorola moto g(30)
    Device fingerprint: motorola/caprip_retail/caprip:12/S0RCS32.41-10-9-2/0ad17-9cdbb:user/release-keys
    Build Type : Release
    Scripting Backend : IL2CPP
    ABI : arm64-v8a
    Strip Engine Code : true
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    at android.app.PendingIntent.checkFlags (PendingIntent.java:377)
    at android.app.PendingIntent.getBroadcastAsUser (PendingIntent.java:647)
    at android.app.PendingIntent.getBroadcast (PendingIntent.java:634)
    at com.yasirkula.unity.NativeShareBroadcastListener.Initialize (NativeShareBroadcastListener.java:32)
    at com.yasirkula.unity.NativeShareFragment.onCreate (NativeShareFragment.java:42)
    at android.app.Fragment.performCreate (Fragment.java:2486)
    at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1261)
    at android.app.FragmentManagerImpl.addAddedFragments (FragmentManager.java:2431)
    at android.app.FragmentManagerImpl.executeOpsTogether (FragmentManager.java:2210)
    at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute (FragmentManager.java:2166)
    at android.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:2067)
    at android.app.FragmentManagerImpl$1.run (FragmentManager.java:742)
    at android.os.Handler.handleCallback (Handler.java:938)
    at android.os.Handler.dispatchMessage (Handler.java:99)
    at android.os.Looper.loopOnce (Looper.java:226)
    at android.os.Looper.loop (Looper.java:329)
    at android.app.ActivityThread.main (ActivityThread.java:8058)
    at java.lang.reflect.Method.invoke (Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1026)
     
  3. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello
    I'm sorry you are having an issue with the asset.
    What is the phone and OS version you are having this crash ?
    Can you tell me more about that crash, when does it happen?
     
  4. nastenke

    nastenke

    Joined:
    Mar 3, 2017
    Posts:
    5
    I don't know when it's happen, in my device it works perfectly, but in Google Play report I see a lot of crashes.
    Here the list of devices:
    realme 8 Android 12 (SDK 31)
    Samsung Galaxy A52 Android 12 (SDK 31)
    Samsung Galaxy S20 FE 5G Android 12 (SDK 31)
    Samsung Galaxy S21 5G Android 12 (SDK 31)
    Samsung Galaxy S22 Android 12 (SDK 31)
    Redmi Note 10 Android 12 (SDK 31)
    Samsung Galaxy Note20 Ultra 5G Android 12 (SDK 31)
    Samsung Galaxy Tab S7 Android 12 (SDK 31)
    Motorola moto g(30) Android 12 (SDK 31)
    realme C25 Android 12 (SDK 31)

    All of them happens at Android 12 (SDK 31)

     
  5. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Thanks for the details.
    This seams to be indeed a bug related to Android 12 coming from Native Share, I'm very sorry for the inconvenience.

    I will look at it and keep you updated.

    Meanwhile, I would recommend disabling the sharing feature for Android 12 to prevent such issue until the issue is solved, for instance by disabling the share button:
    Code (CSharp):
    1. if ( AndroidUtils.GetAndroidSDKVersion()  >= 31) {
    2. sharebutton.SetActive(false);
    3. }
     
  6. nastenke

    nastenke

    Joined:
    Mar 3, 2017
    Posts:
    5
    Thanks!
     
  7. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,698
    G'day!
    I'm using this simple code to allow the user to capture a shot of their character in the game -

    Code (CSharp):
    1. snapshotPath = Application.persistentDataPath + "/Snap.png";
    2. SimpleScreenshotCapture.InitScreenshotTaker();
    3. yield return StartCoroutine(SimpleScreenshotCapture.CaptureCoroutine
    4. (snapshotPath, 1024, 1024, TextureExporter.ImageFileFormat.PNG, 100, new List<Camera> { snapshot.camera }, null, ScreenshotTaker.CaptureMode.RENDER_TO_TEXTURE, 8));
    This works but it is there a way to stop it from automatically saving to the users PhotoGallery?
    I still want to save to the ApplicationData path, is that possible?

    Thanks,
    Pete

    Great Asset by the way :D
     
  8. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello

    Yes, in the SimpleScreenshotCapture.CaptureCoroutine method call just set the exportToGallery parameter to false:
    Code (CSharp):
    1. SimpleScreenshotCapture.CaptureCoroutine(snapshotPath, 1024, 1024, TextureExporter.ImageFileFormat.PNG, 100, new List<Camera> { snapshot.camera }, null, ScreenshotTaker.CaptureMode.RENDER_TO_TEXTURE, 8, true, ScreenshotTaker.ColorFormat.RGB, false, false));
     
    petey likes this.
  9. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,698
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,130
    Great time saver!

    just would be nice to have that "your game logo"-disabled by default,
    now need to go search documentation on how to disable it..

    some issues:
    screenshot filename is "2688x1242-screenshot-iPhone 6.5 inch - 11 Pro Max, 11, XS Max, XR.png"
    but the actual resolution is 1242x2688 ? (flipped height and width..) *ok clicked switch default templates all to landscape seems to fix that

    one resolution seems to fail on capture?
    [d3d11] attempting to ReadPixels outside of RenderTexture bounds! Reading (0, 0, 2048, 2732) from (1920, 1080)
     
    Last edited: Jun 2, 2022
  11. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello,

    sorry about "game logo", I thought it was already disable by default, I will check the example scenes.

    "2688x1242" the symbols refers to the device resolutions, this is why when you flip the display portrait/landscape it doesn't not invert their values.

    Can you tell me more about your capture issue and when it happens ? Do you have some steps to reproduce it ? What graphics card do you have ?
     
  12. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    311
    I get the same issue, have a bunch of resolutions setup and three of them fail with the same [d3d11] attempting to ReadPixels outside of RenderTexture bounds! Reading (0, 0, 2048, 2732) from (1920, 1080) error. But with the wanted resolution of course. Using Unity 2020.3.33f1 and URP.
     
  13. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello
    After some testing it appears that this error may happens in some cases with URP with 2020.3. From my tests, the issue will happens only when you try to capture consecutively two same resolutions:

    temporary workaround -> please reorder all the resolutions you want to capture so that two consecutive captures do not have the same dimensions.

    In last version I optimized the capture process, to gain a few time, I will check with this case fails and publish an update ass soon as possible. If you notice this error in other situations please let me know.
     
    Last edited: Aug 18, 2022
    petey likes this.
  14. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    126
    Updating Native Share to latest version fix the problem. Fixed in Native Share 1.4.6
     
    WildMageGames and B-Erolskiy like this.
  15. nickcolthorpe

    nickcolthorpe

    Joined:
    Jan 20, 2019
    Posts:
    5
    Hi, this asset is excellent and has given me the functionality I was looking for and much more, so thank you for making this.

    I do have a question though. I am creating a first-person DIY simulation type game and using this asset for the player to take a photo of the completed jobs (image 1), view them in the gallery and share them with an NPC girlfriend (image 2) who responds depending on various conditions (image 3).

    Within the messages I would like a thumbnail of the photo to show, so not only would I need one for the Gallery Greybox, but for this aswell and generate it within a prefab. How could this be done?

    Also, I notice that the images are stored in a folder on the PC, but if the player deletes the image they have shared, I would not want the image within the messages to disappear.

    I hope this makes sense!!!

    PS: I am using a visual scripting asset called Game Creator (2)

    Kind regards
     

    Attached Files:

  16. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello,

    When you create screenshots, you can chose to save them to the DATA_PATH. That's the folder where your game content is stored, so the user is less likely to remove them.
    When you capture the screenshot, you should store the screenshot path as a reference for later uses.
    When you share your picture via message UI, try creating a RawImage UI object within the message system to display a texture. You can load the texture using the asset utility method TextureExporter.LoadFromFile() and the path you stored previously, and associate it to the RawImage UI texture object.
     
  17. nickcolthorpe

    nickcolthorpe

    Joined:
    Jan 20, 2019
    Posts:
    5
    Hi,

    Thank you for your speedy response.

    The DATA_PATH is a good shout, I will certainly need that when I build the game.

    I have created the RawImage object, but I am not a coder and with Game Creator I can only Invoke a Method. I cannot access the TextureExporter script because it does not derive from Monobehavior. Would I need to create another Greybox Canvas for the message UI?

    Many thanks
     
  18. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Hello,
    It's hard to answer to your question, it's very dependent on how your messaging system works, how the rawimage within are referenced, and on how you capture and store the screenshots.

    I made a custom script for you:
    attach it to your rawimage game object
    when you want to display the texture, use the SetFileName(...) to set the screenshot filename that you stored,
    and then Load() to load the texture. I added ratio scaling settings too.
     

    Attached Files:

  19. nickcolthorpe

    nickcolthorpe

    Joined:
    Jan 20, 2019
    Posts:
    5
    Hi

    Thank you so much, this is very kind of you to write a custom script.

    It is working almost perfectly and I realise I have a very specific use case for this.

    As far as I can see the SetFileName(...) is a string which I have to manually type in, I use this example (Assets\Screenshots\screenshot.png) which pulls that image from the folder.

    Although, I would need the image which is currently open in the greybox to fill that SetFileName field, dependent on which one was chosen from the gallery. I feel that I am so close to having this cracked. Would it have something to do with the CurrentImageId?

    Many thanks
     
    WildMageGames likes this.
  20. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    Yes, you can use m_Gallery.m_ImageFiles[m_CurrentImageId].m_FullName to get the full name of the current image in the greybox to be used with SetFileName(...)
     
  21. nickcolthorpe

    nickcolthorpe

    Joined:
    Jan 20, 2019
    Posts:
    5
    Sorry to be a pain, but would I need to add this to the script?
     
  22. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    265
    I do not know how you use the gallery, greybox and the script I sent you, so it's very hard to tell you what to do. If you detail more what your objects are, and how you use them, maybe I will understand and be able to provide more help.
     
  23. nickcolthorpe

    nickcolthorpe

    Joined:
    Jan 20, 2019
    Posts:
    5
    I will email you, I wouldn't want to clog up this thread o_O