Easy Mobile API Reference 2.4
  • Basic
    • Pro
    • Basic

    Show / Hide Table of Contents

    Class Sharing

    Inheritance
    System.Object
    Sharing
    Namespace: EasyMobile
    Assembly: cs.temp.dll.dll
    Syntax
    public static class Sharing

    Methods

    CaptureScreenshot()

    Captures a full-screen screenshot and returns the generated Texture2D object. Note that this method should be called at the end of the frame (called within a coroutine after WaitForEndOfFrame())

    Declaration
    public static Texture2D CaptureScreenshot()
    Returns
    Type Description
    Texture2D

    The full-screen screenshot.

    CaptureScreenshot(Single, Single, Single, Single)

    Captures the specified area of the screen and returns the generated Texture2D object. Note that this method should be called at the end of the frame (called within a coroutine after WaitForEndOfFrame())

    Declaration
    public static Texture2D CaptureScreenshot(float startX, float startY, float width, float height)
    Parameters
    Type Name Description
    System.Single startX

    Start x.

    System.Single startY

    Start y.

    System.Single width

    Width.

    System.Single height

    Height.

    Returns
    Type Description
    Texture2D

    The screenshot.

    SaveScreenshot(Single, Single, Single, Single, String)

    Captures the specified area of the screen and saves the screenshot as a PNG image with the given filename.. The created file is saved to the persistentDataPath if running on mobile devices, or to Assets folder if running in the editor. Note that this method should be called at the end of the frame (called within a coroutine after WaitForEndOfFrame())

    Declaration
    public static string SaveScreenshot(float startX, float startY, float width, float height, string filename)
    Parameters
    Type Name Description
    System.Single startX

    Start x.

    System.Single startY

    Start y.

    System.Single width

    Width.

    System.Single height

    Height.

    System.String filename

    Filename to store the resulted PNG image without the file extension.

    Returns
    Type Description
    System.String

    The filepath to the saved screenshot.

    SaveScreenshot(String)

    Captures the whole screen and saves the screenshot as a PNG image with the given filename. The created file is saved to the persistentDataPath if running on mobile devices, or to Assets folder if running in the editor. Note that this method should be called at the end of the frame (called within a coroutine after WaitForEndOfFrame())

    Declaration
    public static string SaveScreenshot(string filename)
    Parameters
    Type Name Description
    System.String filename

    Filename to store the resulted PNG image without the file extension.

    Returns
    Type Description
    System.String

    The filepath to the saved screenshot.

    ShareImage(String, String, String)

    Shares the image at the given path via native sharing utility.

    Declaration
    public static void ShareImage(string imagePath, string message, string subject = "")
    Parameters
    Type Name Description
    System.String imagePath

    Image path.

    System.String message

    Message.

    System.String subject

    Subject.

    ShareScreenshot(Single, Single, Single, Single, String, String, String)

    Captures the specified area of the screen, saves it as a PNG image and then shares it to social networks via the native sharing utility. The parameters specify the area of the screen are in pixels (screen space). Note that this method should be called at the end of the frame (called within a coroutine after WaitForEndOfFrame())

    Declaration
    public static string ShareScreenshot(float startX, float startY, float width, float height, string filename, string message, string subject = "")
    Parameters
    Type Name Description
    System.Single startX

    Start x.

    System.Single startY

    Start y.

    System.Single width

    Width.

    System.Single height

    Height.

    System.String filename

    Filename to store the resulted PNG image without the file extension.

    System.String message

    Message.

    System.String subject

    Subject.

    Returns
    Type Description
    System.String

    The filepath to the saved screenshot.

    ShareScreenshot(String, String, String)

    Captures the screenshot, saves it as a PNG image and then shares it to social networks via the native sharing utility. Note that this method should be called at the end of the frame (called within a coroutine after WaitForEndOfFrame())

    Declaration
    public static string ShareScreenshot(string filename, string message, string subject = "")
    Parameters
    Type Name Description
    System.String filename

    Filename to store the resulted PNG image without the file extension.

    System.String message

    Message.

    System.String subject

    Subject.

    Returns
    Type Description
    System.String

    The filepath to the saved screenshot.

    ShareText(String, String)

    Shares a text using the native sharing utility. Note that Facebook doesn't allow pre-filled sharing message, so the text will be discarded when sharing to that particular network.

    Declaration
    public static void ShareText(string text, string subject = "")
    Parameters
    Type Name Description
    System.String text

    Text.

    System.String subject

    Subject.

    ShareTexture2D(Texture2D, String, String, String)

    Generates a PNG image from the given Texture2D object, saves it to persistentDataPath using the given filename and then shares the image via the native sharing utility.

    Declaration
    public static string ShareTexture2D(Texture2D tt, string filename, string message, string subject = "")
    Parameters
    Type Name Description
    Texture2D tt

    Tt.

    System.String filename

    Filename to store the resulted PNG image without the file extension.

    System.String message

    Message.

    System.String subject

    Subject.

    Returns
    Type Description
    System.String

    The filepath to the saved image.

    ShareURL(String, String)

    Shares a URL using the native sharing utility.

    Declaration
    public static void ShareURL(string url, string subject = "")
    Parameters
    Type Name Description
    System.String url

    URL.

    System.String subject

    Subject.

    In This Article
    • Methods
      • CaptureScreenshot()
      • CaptureScreenshot(Single, Single, Single, Single)
      • SaveScreenshot(Single, Single, Single, Single, String)
      • SaveScreenshot(String)
      • ShareImage(String, String, String)
      • ShareScreenshot(Single, Single, Single, Single, String, String, String)
      • ShareScreenshot(String, String, String)
      • ShareText(String, String)
      • ShareTexture2D(Texture2D, String, String, String)
      • ShareURL(String, String)