Class ShareSheet
The ShareSheet class provides an interface to access standard services from your app.
Inheritance
Namespace: VoxelBusters.EssentialKit
Assembly: cs.temp.dll.dll
Syntax
public sealed class ShareSheet : NativeFeatureBehaviour
Examples
The following code example shows how to use share sheet.
using UnityEngine;
using System.Collections;
using VoxelBusters.EssentialKit;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
ShareSheet newComposer = ShareSheet.CreateInstance();
newComposer.AddText("Example");
newComposer.AddScreenshot();
newComposer.SetCompletionCallback(OnShareSheetClosed);
newComposer.Show();
}
private void OnShareSheetClosed(ShareSheetResult result, Error error)
{
// add your code
}
}
Methods
AddImage(Byte[], String)
Adds the specified image to the share sheet.
Declaration
public void AddImage(byte[] imageData, string mimeType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | imageData | The image to add to the post. |
| System.String | mimeType |
AddImage(Texture2D, TextureEncodingFormat)
Adds the specified image to the share sheet.
Declaration
public void AddImage(Texture2D image, TextureEncodingFormat textureEncodingFormat = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | image | The image to add. |
| TextureEncodingFormat | textureEncodingFormat |
AddScreenshot()
Creates a screenshot and adds it to the share sheet.
Declaration
public void AddScreenshot()
AddText(String)
Adds the initial text to the share sheet.
Declaration
public void AddText(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The text to add. |
AddURL(URLString)
Adds the URL to the share sheet.
Declaration
public void AddURL(URLString url)
Parameters
| Type | Name | Description |
|---|---|---|
| URLString | url | The URL to add. |
AwakeInternal(Object[])
Declaration
protected override void AwakeInternal(object[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object[] | args |
CreateInstance()
Initializes a new instance of the ShareSheet class.
Declaration
public static ShareSheet CreateInstance()
Returns
| Type | Description |
|---|---|
| ShareSheet |
DestroyInternal()
Declaration
protected override void DestroyInternal()
GetFeatureName()
Declaration
protected override string GetFeatureName()
Returns
| Type | Description |
|---|---|
| System.String |
IsAvailable()
Declaration
public override bool IsAvailable()
Returns
| Type | Description |
|---|---|
| System.Boolean |
SetCompletionCallback(EventCallback<ShareSheetResult>)
Specify the action to execute after the share sheet is dismissed.
Declaration
public void SetCompletionCallback(EventCallback<ShareSheetResult> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| EventCallback<ShareSheetResult> | callback | The action to be called on completion. |
Show()
Shows the share sheet interface, anchored at screen position (0, 0).
Declaration
public void Show()
Show(Vector2)
Shows the share sheet interface, anchored to given position.
Declaration
public void Show(Vector2 screenPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | screenPosition | The position (in the coordinate system of screen) at which to anchor the share sheet menu. This property is used in iOS platform only. |