素31 SocialPlugin问题。
如何附加和共享已存储在资产中的图片?我理解所有的代码,但我不确定资产中图片的文件路径。
在演示中,插件分享了一个屏幕截图在开始。这在我的游戏中是正确的。
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
}发布于 2014-05-06 16:42:07
其实很简单。
您所需要的只是将您想要共享的准备好的映像放到StreamingAssets文件夹中(如果没有,则在资产文件夹中创建它),并将Application.persistentDataPath更改为Application.streamingAssetsPath
就这样。
#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." } );
#endifhttps://stackoverflow.com/questions/23466305
复制相似问题