Essential Kit
Loading...
Searching...
No Matches
SocialShareComposersealed

The SocialShareComposer class provides an interface to compose a post for supported social networking services. More...

Public Member Functions

void SetText (string value)
 Adds the initial text to be posted.
 
void AddScreenshot ()
 Creates a screenshot and adds it to the post.
 
void AddImage (Texture2D image, TextureEncodingFormat textureEncodingFormat=TextureEncodingFormat.JPG)
 Adds an image to the post.
 
void AddImage (byte[] imageData)
 Adds an image to the post.
 
void AddURL (URLString url)
 Adds a URL to the post.
 
void SetCompletionCallback (EventCallback< SocialShareComposerResult > callback)
 Specify the action to execute after the share sheet is dismissed.
 
void Show ()
 Shows the share sheet interface, anchored at screen position (0, 0).
 
void Show (Vector2 screenPosition)
 Shows the share sheet interface, anchored to given position.
 

Static Public Member Functions

static SocialShareComposer CreateInstance (SocialShareComposerType composerType)
 Initializes a new instance of the SocialShareComposer class.
 
static bool IsComposerAvailable (SocialShareComposerType composerType)
 Checks if a composer is available.
 

Detailed Description

The following code example shows how to create composer for Facebook

using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
newComposer.AddText("Example");
newComposer.AddScreenshot();
newComposer.SetCompletionCallback(OnShareComposerClosed);
newComposer.Show();
}
private void OnShareComposerClosed(SocialShareComposerResult result, Error error)
{
// add your code
}
}
The SocialShareComposer class provides an interface to compose a post for supported social networking...
Definition SocialShareComposer.cs:41
void AddScreenshot()
Creates a screenshot and adds it to the post.
Definition SocialShareComposer.cs:155
void SetCompletionCallback(EventCallback< SocialShareComposerResult > callback)
Specify the action to execute after the share sheet is dismissed.
Definition SocialShareComposer.cs:235
static SocialShareComposer CreateInstance(SocialShareComposerType composerType)
Initializes a new instance of the SocialShareComposer class.
Definition SocialShareComposer.cs:56
void Show()
Shows the share sheet interface, anchored at screen position (0, 0).
Definition SocialShareComposer.cs:247
This class contains the result of the user action which caused SocialShareComposer interface to dismi...
Definition SocialShareComposerResult.cs:12
Namespace for essential kit features. You need to import this namespace along with VoxelBusters....
Definition AddressBook.cs:8
SocialShareComposerType
The enum specifies the sharing service you want to post to.
Definition SocialShareComposerType.cs:11

Member Function Documentation

◆ CreateInstance()

static SocialShareComposer CreateInstance ( SocialShareComposerType composerType)
static
Parameters
composerTypeComposer type.

◆ IsComposerAvailable()

static bool IsComposerAvailable ( SocialShareComposerType composerType)
static
Parameters
composerTypeComposer type.

◆ SetText()

void SetText ( string value)
Parameters
valueThe text to add to the post.

◆ AddImage()

void AddImage ( byte[] imageData)
Parameters
imageDataThe image to add to the post.

◆ AddURL()

void AddURL ( URLString url)
Parameters
urlThe URL to add to the post.

References URLString.IsValid.

◆ SetCompletionCallback()

void SetCompletionCallback ( EventCallback< SocialShareComposerResult > callback)
Parameters
callbackThe action to be called on completion.

◆ Show()

void Show ( Vector2 screenPosition)
Parameters
screenPositionThe position (in the coordinate system of screen) at which to anchor the share sheet menu. This property is used in iOS platform only.