Prime 31 SocialPlugin question.
How do I attach and share picture already stored in my assets? I understand all the code but I'm not sure about the file path to the picture within the assets.
In the demo the plugin shares a screenshot taken in the beginning. This work correctly in my game.
protected override void OnButtonTap ()
{
base.OnButtonTap ();
#if UNITY_IPHONE
var pathToImage = ????? // what here??
if( !System.IO.File.Exists( pathToImage ) )
{
Debug.Log( "there is no screenshot avaialable at path: " + pathToImage );
return;
}
SharingBinding.shareItems( new string[] { pathToImage, "Description" } );
#endif
}
It's pretty simple in fact.
All you need is to put your prepared image you want to share to StreamingAssets folder (create it in Assets folder if you don't have one)
And change Application.persistentDataPath
to Application.streamingAssetsPath
That's it.
#if UNITY_IPHONE
var pathToImage = System.IO.Path.Combine(Application.streamingAssetsPath, screenshotFilename);
if( !System.IO.File.Exists( pathToImage ) )
{
Debug.Log( "there is no screenshot avaialable at path: " + pathToImage );
return;
}
SharingBinding.shareItems( new string[] { pathToImage, "Amazing app for your kids. Check it out." } );
#endif