NatShare
Search…
SharePayload
class NatSuite.Sharing.SharePayload
This payload is used to share items using the native sharing UI.

Creating the Payload

1
/// <summary>
2
/// Create a share payload.
3
/// </summary>
4
SharePayload ();
Copied!
This payload does not require any parameters.

Adding Text

1
/// <summary>
2
/// Add plain text to the payload.
3
/// </summary>
4
/// <param name="text">Plain text to add.</param>
5
void AddText (string text);
Copied!
Refer to the Adding Text section of the ISharePayload interface for more information.

Adding Images

1
/// <summary>
2
/// Add an image to the payload from a pixel buffer.
3
/// The pixel buffer MUST have an RGBA8888 pixel layout.
4
/// </summary>
5
/// <param name="pixelBuffer">Pixel buffer containing image to add.</param>
6
/// <param name="width">Image width.</param>
7
/// <param name="height">Image height.</param>
8
void AddImage<T> (T[] pixelBuffer, int width, int height) where T : struct;
9
10
/// <summary>
11
/// Add an image to the payload.
12
/// Note that the image MUST be readable.
13
/// </summary>
14
/// <param name="image">Image to add.</param>
15
void AddImage (Texture2D image);
Copied!
Refer to the Adding Images section of the ISharePayload interface for more information.

Adding Media Files

1
/// <summary>
2
/// Add a media file to the payload.
3
/// </summary>
4
/// <param name="path">Path to media file to add.</param>
5
void AddMedia (string path);
Copied!
Refer to the Adding Media Files section of the ISharePayload interface for more information.

Sharing the Payload

1
/// <summary>
2
/// Commit the payload and return the success value.
3
/// </summary>
4
/// <returns>Whether the sharing action was successfully completed.</returns>
5
Task<bool> Commit ();
Copied!
Refer to the Committing the Payload section of the ISharePayload interface for more information.
Last modified 1yr ago