Add Extra Content(Stickers & Links)

Learn how to add Stickers, Caption Text & Links to the content being shared

For any sharing content (image/video/live camera), you can add three kinds of extra data.

  • Stickers

Stickers allow to show additional content to attribute the existing sharing content. Only one sticker is allowed. A still sticker must be a PNG 1MB or smaller. An animated sticker must be a GIF or WebP (preferred) 1MB or smaller.

  • Caption Text

This is the caption given to the sharing content once after sharing. Captions are limited to 250 characters.

  • Attachment URL

URL that can be attached to the sharing content. Usually, you can link your game or attach a deep link to your game content. The attachment URL must be a properly formatted URL in string format.

Add Sticker

Create Sticker

Create SnapchatSticker Instance and set its properties. Properties include position of sticker, rotation and size in pixels.

private SnapchatSticker CreateSticker()
{
SnapchatSticker sticker = null;
sticker = new SnapchatSticker(Application.persistentDataPath + "/" + SharingStickerName);
// Set Position in normalised screen coordinates
sticker.SetPosition(0.5f, 0.5f);
// Set rotation in degrees
sticker.SetRotation(-45f);
// Set size for the sticker in pixels
sticker.SetSize(Screen.width * 0.3f, Screen.height * 0.3f);
return sticker;
}

Set Sticker to content

Set SnapchatSticker instance created above to SnapchatContent Instance.

SnapchatContent content;
....
....
SnapchatSticker sticker = CreateSticker();// Refer code above
content.SetSticker(sticker);
....
SnapchatKitManager.Share(content, OnShareComplete);

Add Caption Text

This is the message displayed over the sharing content (Image/Video/LiveCamera). Pass the text to SnapchatContent instance.

content.SetCaptionText("My awesome game!");

Add Attachment Url

Pass url which can be opened once the user shares on snapchat. Usually this can be the url of your game so the snapchat users can find it on app store.

content.SetAttachmentUrl("https://www.google.com");

Example

using VoxelBusters.SnapchatKit;
void ShareToSnapchat(string contentFilePath, bool isVideo)
{
SnapchatContent content;
if(isVideo)
{
content = new SnapchatContent(eSnapchatContentType.Video);
}
else
{
content = new SnapchatContent(eSnapchatContentType.Photo);
}
// Set content data
content.SetContentData(contentFilePath);
// Set sticker
SnapchatSticker sticker = CreateSticker();
content.SetSticker(sticker);
// Set Caption Text
content.SetCaptionText("My Aweseome Game");
// Set Attachment Url
content.SetAttachmentUrl("https://www.play.google.com");
// Share
SnapchatKitManager.Share(content, OnShareComplete);
}
private SnapchatSticker CreateSticker()
{
SnapchatSticker sticker = null;
sticker = new SnapchatSticker(Application.persistentDataPath + "/" + SharingStickerName);
// Set Position in normalised screen coordinates
sticker.SetPosition(0.5f, 0.5f);
// Set rotation in degrees
sticker.SetRotation(-45f);
// Set size for the sticker in pixels
sticker.SetSize(Screen.width * 0.3f, Screen.height * 0.3f);
return sticker;
}
private void OnShareComplete(bool success, string error)
{
string message = success ? "Successfully Shared" : "Failed to share " + error;
Debug.Log(message);
}