Share text, links, and files on iOS!
Uses the native iOS sharing menu to give access to all of the built in social networks. Compatible with iOS 6 and higher.
Diffusion supports iOS 8 Extensions and automatically includes any additional platforms the user has installed on their device.
There is also a simple interface for adding your own custom UIActivities for whatever platforms you may want to support!
Install the Unity package and drop the Diffusion prefab into your scene, then you're ready to go.
Share() message to the prefab to share your content!
Diffusion 2.1.0 now requires Xcode 6 to build!
Diffusion 2.0 uses a new PostProcessBuildPlayer script to add it's dependencies. Upgrading from 1.x may have conflicts, so you should remove the old PostProcessor files:
Be cautious when removing these files though, as mod_pbxproj is used by several other plugins. Removing them may accidentally break other plugins.
You can read more about the new PostProcessBuildPlayer on our blog here.
The networking menu is generated automatically based on what type of data you want to share, and what platforms are available. If the user has not signed into Facebook, it will not show up in the list, for example. However, sometimes options will show up that you do not actually want. For example if you're only sharing text, you may get a "Copy" option which isn't very useful.
This selection will allow you to explicitly hide options that you do not want to show. Many are disabled by default.
Note that this field has no influence over any iOS 8 Extensions the user may have access to. For example, if the user has Pinterest installed on their device, it will always show in the menu if you try to share an image.
Diffusion offers an interface for using external UIActivities. To use them, you need to include the
files provided by the UIActivity into
Plugins/iOS in your Unity project, and add the class to the
Custom Platforms field on the Diffusion prefab.
In order for Diffusion to access the classes for your custom UIActivity, you'll need to create a new
category that includes the headers. You can do this through the new file menu in Xcode, or by hand.
A template is included in the
Custom Platforms folder.
Shares the message and URL set in the inspector.
Share(string message, string filePath)
Shares the message provided, and a file.
Share(string message, string url, string filePath)
Shares a message, URL, and file as provided.
Checks if the user has logged into Facebook.
Posts the message and URL set in the inspector to Facebook.
PostToFacebook(string message, string imagePath)
Posts the message and image to Facebook.
PostToFacebook(string message, string url, string imagePath)
Posts a message, URL, and image to Facebook.
Checks if the user has logged into Twitter.
Posts the message and URL set in the inspector to Twitter.
PostToTwitter(string message, string imagePath)
Posts the message and image to Twitter.
PostToTwitter(string message, string url, string imagePath)
Posts a message, URL, and image to Twitter.
If you connect a GameObject into the Event Receiver field on the Diffusion prefab, it will these messages will be sent to it.
Do not put your event receiver script on the prefab.
Sharing completed successfully. Returns the platform the user selected to share with.
User cancelled the sharing process.
For slightly better performance, or if multiple listeners are necessary, the above events are also exposed as delegates.
Twitter's URL shortener assumed any URL to be 22 characters (20, plus spaces). In reality, there is a bug in the UIActivity's character counting, and URLs show as 36 characters.
Facebook will not prefill a message supplied through code, when selected from the share menu. This is to comply with Facebook's Platform Policy (2.3).
PostToFacebook methods return the same callbacks as if the user selected those
options from the general share menu.
There is an included ScarletPostProcessor script, which is used to enable Objective-C modules in your Xcode project.
This is to link Social.framework, only to enable the
If the post-process script is causing problems for your project you can enable modules manually in Xcode's build settings.