Overview
Facebook Story Kit shares images, videos and stickers from your Unity game to Facebook Stories and Reels, on Android and iOS. One static C# class opens the Facebook app with your content ready to post. There is no Facebook SDK to install, no login and nothing to add to your manifest, Gradle files or Info.plist.
The kit shares files you already have: a screenshot, a recording, a picture made by the player. It does not capture
screenshots or record video itself (Unity's ScreenCapture does the first; see
Share a screenshot).
Share in one line
Set your App ID once, then pass a file path: the Facebook app opens with your story.
Stories and Reels
Seven calls: image, video, sticker and gradient Stories, and video Reels with or without a sticker.
Zero setup
The plugin brings its own FileProvider, manifest queries, androidx dependency and Info.plist schemes.
Ready-to-run demo
Every share call on one screen, with a sample image, sticker and video.
Requirements
| Item | Version | Notes |
|---|---|---|
| Unity | 6000.0+ | Android and/or iOS build support installed |
com.unity.ugui | 2.0+ | The demo's UI only |
| Facebook app | current | Installed on the player's device. Without it, the share calls do nothing and IsFacebookInstalled() returns false. |
| Facebook App ID | From developers.facebook.com. Facebook requires it for every share. |
Android needs nothing else: the plugin's Android library declares its own FileProvider, the
<queries> entry for the Facebook app and the androidx.core dependency, which Gradle
downloads from Google's Maven repository during the build. On iOS, a build step adds the Facebook URL schemes to
Info.plist.
Quick start
- Import the package The plugin lands in
Assets/hardartcore/FacebookStoryShareand the demo media inAssets/StreamingAssets/FacebookStoryShare. - Set your App ID Once, before the first share:
FacebookStoryShareHelper.FacebookAppId = "1234567890"; - Save a file Write the image or video to
Application.persistentDataPathorApplication.temporaryCachePath. - Share it Call one of the share methods with the file's absolute path. Build to an Android or iOS device with the Facebook app installed.
using Hardartcore.Facebook;
using UnityEngine;
public class ShareButton : MonoBehaviour
{
private void Awake()
{
FacebookStoryShareHelper.FacebookAppId = "1234567890";
}
public void Share()
{
var path = Application.persistentDataPath + "/score.png";
if (FacebookStoryShareHelper.IsFacebookInstalled())
{
FacebookStoryShareHelper.ShareImageToFacebookStory(path);
}
}
}
Every call is a safe no-op in the Editor and on other platforms, and IsFacebookInstalled() returns false there. Test sharing on a device.
The demo
Open Demo/Scenes/DemoScene. It copies the sample image.jpg, sticker.png and
video.mp4 out of StreamingAssets/FacebookStoryShare into
Application.persistentDataPath (Facebook needs real files), shows the image and sticker in a story
preview, and has one button per share call. Set your App ID on the Demo object's
DemoSceneScript before building.
The status chip shows whether the Facebook app is installed. When it is missing on a device, the share buttons are disabled. The layout adapts to portrait and landscape.
Share a screenshot
public IEnumerator ShareScreenshot()
{
yield return new WaitForEndOfFrame();
var texture = ScreenCapture.CaptureScreenshotAsTexture();
var path = Path.Combine(Application.temporaryCachePath, "screenshot.png");
File.WriteAllBytes(path, texture.EncodeToPNG());
Destroy(texture);
FacebookStoryShareHelper.ShareImageToFacebookStory(path);
}
API reference
Everything is on the static class Hardartcore.Facebook.FacebookStoryShareHelper. Paths are absolute
file paths. Colours are hex strings such as "#CC3322".
- FacebookAppId
string. Your Facebook App ID. Set it before sharing.- IsFacebookInstalled()
bool. True when the Facebook app is on the device. Share calls do nothing without it.- ShareImageToFacebookStory(image, attributionLink = null)
- An image as the story background.
- ShareImageWithStickerToFacebookStory(image, sticker, attributionLink = null)
- An image background with a sticker on top, which the player can move and resize.
- ShareStickerWithGradientToFacebookStory(sticker, topColor, bottomColor, attributionLink = null)
- A sticker on a two-colour gradient. The same colour twice gives a solid background.
- ShareVideoToFacebookStory(video, attributionLink = null)
- A video as the story background.
- ShareVideoWithStickerToFacebookStory(video, sticker, attributionLink = null)
- A video background with a sticker on top.
- ShareVideoReel(video, attributionLink = null)
- A video to the Reels composer.
- ShareVideoReelWithSticker(video, sticker, attributionLink = null)
- A video to the Reels composer with a sticker on top.
- SetFileProvider(suffix)
- Android Not needed: the plugin has its own provider. Use it only to share through a
FileProvideryou declared yourself, passing its authority suffix with a leading dot (".fileprovider"forcom.your.game.fileprovider). - GetExternalFilesPath(name)
- Android The path of the app-specific external directory
name(Context.getExternalFilesDir). Null elsewhere. - CopyFile(name)
- Android Copies
StreamingAssets/nameto the app-specific external files folder. The demo shows a cross-platform way withUnityWebRequest.
Android only, and Facebook only shows it for apps it has approved for attribution links. iOS ignores it.
Media specs
Facebook's limits, from its Sharing to Stories and Sharing to Reels guides:
| Asset | Formats | Recommended |
|---|---|---|
| Story image | JPG, PNG | 9:16 |
| Story video | H.264, H.265, WebM | 1080p or more, up to 20 seconds, under 50 MB |
| Reel video | H.264, H.265, WebM | 1080p, 3 to 60 seconds, under 50 MB |
| Sticker | JPG, PNG | 640×480, transparent PNG for a cut-out look |
How it works
Android
Each call builds a Facebook intent (com.facebook.stories.ADD_TO_STORY or
com.facebook.reels.SHARE_TO_REEL), turns your file paths into content:// URIs with the
plugin's FileProvider, grants Facebook read access to them and starts the Facebook app. The Android
library Plugins/Android/FacebookStoryShare.androidlib adds to your build:
- FileProvider
com.hardartcore.facebook.FacebookStoryFileProviderwith the authority<your application id>.hardartcore.fbstory. Its own class name, so it never clashes with another plugin's or your ownFileProvider.- Shared folders
- External storage, the app's files folder and cache folder:
Application.persistentDataPathandApplication.temporaryCachePathwork whether they are external or internal. No storage permission is needed. - Queries
<queries><package android:name="com.facebook.katana"/></queries>, so Android 11+ lets the app see Facebook.- Dependency
androidx.core:core:1.9.0in the library'sbuild.gradle. Gradle picks the highest version when other plugins need it too.- ProGuard
proguard-rules.prokeepscom.hardartcore.facebook.**, which C# calls by name, when you enable minification.
iOS
Each call puts your file data on the pasteboard under Facebook's com.facebook.sharedSticker.* keys
(expiring after five minutes) and opens facebook-stories://share or
facebook-reels://share. Scripts/Editor/FacebookShareIOSPostProcess.cs adds
facebook-stories and facebook-reels to LSApplicationQueriesSchemes in
Info.plist after every iOS build, so canOpenURL can see Facebook.
Facebook only accepts Reels from apps in Live mode in the App Dashboard.
Folder layout
Assets/ ├── hardartcore/FacebookStoryShare/ │ ├── Documentation.html this documentation │ ├── Scripts/ │ │ ├── FacebookStoryShareHelper.cs the C# API │ │ └── Editor/ Info.plist build step, Help menu items │ ├── Plugins/ │ │ ├── Android/FacebookStoryShare.androidlib/ │ │ │ ├── build.gradle androidx.core dependency, ProGuard rules │ │ │ └── src/main/ manifest, Java helper and FileProvider, shared paths │ │ └── iOS/FacebookStoryShare.mm pasteboard + URL scheme bridge │ └── Demo/ DemoScene, its scripts, Nunito font, icons └── StreamingAssets/FacebookStoryShare/ the demo's image, sticker and video
The demo and StreamingAssets/FacebookStoryShare can be deleted; the plugin does not use them.
Upgrading from 1.x
- Delete the old library Remove
Plugins/Android/facebook-release.aarandEditor/FacebookShareAndroidDependencies.xmlif they are still in the project: importing an update does not delete files. - Remove the old provider Delete the
<provider>you added toAssets/Plugins/Android/AndroidManifest.xmlfor this asset (the one pointing at@xml/file_paths), or the build fails with a missing resource. The<queries>entry andREAD_EXTERNAL_STORAGEare no longer needed either. - Move your App ID Replace the edited
FacebookAppIdconstant withFacebookStoryShareHelper.FacebookAppId = "..."; - Drop SetFileProvider Remove
SetFileProvider(...)calls, unless you keep sharing through your own provider.
Troubleshooting
- Nothing happens on share
- The Facebook app is not installed (check
IsFacebookInstalled()), or the file does not exist. Facebook also shows an error when the App ID is empty or wrong. - Failed to find configured root
- Android: the file is outside the shared folders. Save it under
Application.persistentDataPathorApplication.temporaryCachePath. - Duplicate class androidx.core...
- Another plugin copied
androidx.coreAAR files intoAssets/Plugins/Android(External Dependency Manager without Gradle templates). Turn on EDM's Patch mainTemplate.gradle option and resolve again, so Gradle resolves every dependency once. - Resource xml/file_paths not found
- The provider added for version 1.x is still in your manifest. See Upgrading.
- IsFacebookInstalled() is false on iOS
- Another build step replaced Info.plist after this one. Check that
LSApplicationQueriesSchemesin the Xcode project listsfacebook-storiesandfacebook-reels.
Third-party notices
The demo includes two third-party components. Everything else in the package, including the scripts, plugins and the rest of the demo, is original work by HardArtcore. Facebook is a trademark of Meta Platforms, Inc.; this package is not affiliated with or endorsed by Meta.
| Component | Location | License |
|---|---|---|
| Nunito font Copyright 2014 The Nunito Project Authors (github.com/googlefonts/nunito) | Demo/UI/Fonts/ | SIL Open Font License 1.1 |
| Material Symbols icons Copyright Google LLC (github.com/google/material-design-icons) | Demo/UI/Icons/ | Apache License 2.0 |
The full licence texts ship in the package's Documentation.html, and online: SIL Open Font License 1.1, Apache License 2.0.
Release notes
2.0.0
- iOS support: every Story and Reel call, through the pasteboard and Facebook's URL schemes, with the Info.plist schemes added on build.
- Zero setup on Android: an Android library with its own FileProvider, the Facebook
<queries>entry, theandroidx.coredependency and ProGuard rules. No AAR, no manifest edits, no Gradle templates, no External Dependency Manager. FacebookStoryShareHelper.FacebookAppIdreplaces editing a constant in the plugin.- A new demo in portrait and landscape with a story preview; its media now ships in StreamingAssets.
- Unity 6 or newer.
1.4
- FacebookStoryShareHelper is a static class: no need to initialise it or add it to a scene.
1.3
- Share videos to Facebook Reels.
Need help?
Questions, bug reports or feature requests: I usually reply within a day.
Last updated November 4, 2026.