Cross Platform Native Plugins
A true cross platform tool for Unity which provides unique and unified way to access native functionality on mobile platforms.
Public Member Functions | Properties | List of all members
ShareSheet Class Reference

Provides an interface to display native view with various share services that your users can choose to use from your application. More...

Public Member Functions

 ShareSheet ()
 Initializes a new instance of the ShareSheet class. More...
 
override void AttachImage (Texture2D _texture)
 Adds the specified image to the post. More...
 

Properties

string Text [get, set]
 The string contains the text message to be shared. More...
 
string URL [get, set]
 The string contains the URL to be shared. More...
 
byte[] ImageData [get]
 The raw data of the image to be shared. (read-only) More...
 
virtual eShareOptions[] ExcludedShareOptions [get, set]
 The list of services that should not be displayed. More...
 
- Properties inherited from IShareView
bool IsReadyToShowView [get]
 A bool value that indicates whether this instance is ready to present composer view. (read-only) More...
 

Detailed Description

Provides an interface to display native view with various share services that your users can choose to use from your application.

It provides several share services such as posting content to social media sites, sending items via email or SMS, and more.

The following code example demonstrates how to use share sheet.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShareViaShareSheet ()
{
// Create new instance and populate fields
ShareSheet _shareSheet = new ShareSheet();
_shareSheet.Text = "This is a test message.";
// On iPad, popover view is used to show share sheet. So we need to set its position
NPBinding.UI.SetPopoverPointAtLastTouchPosition();
// Show composer
NPBinding.Sharing.ShowView(_shareSheet, FinishedSharing);
}
private void OnFinishedSharing (eShareResult _result)
{
// Insert your code
}
}

Constructor & Destructor Documentation

Initializes a new instance of the ShareSheet class.

Member Function Documentation

override void AttachImage ( Texture2D  _texture)

Adds the specified image to the post.

Parameters
_textureUnity texture object that has to be shared.

Property Documentation

string Text
getset

The string contains the text message to be shared.

string URL
getset

The string contains the URL to be shared.

byte [] ImageData
get

The raw data of the image to be shared. (read-only)

virtual eShareOptions [] ExcludedShareOptions
getset

The list of services that should not be displayed.