首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Prime31社交插件iOS -如何附加和分享已经存储在我资产中的图片?

Prime31社交插件iOS -如何附加和分享已经存储在我资产中的图片?
EN

Stack Overflow用户
提问于 2014-05-05 06:38:23
回答 1查看 611关注 0票数 0

素31 SocialPlugin问题。

如何附加和共享已存储在资产中的图片?我理解所有的代码,但我不确定资产中图片的文件路径。

在演示中,插件分享了一个屏幕截图在开始。这在我的游戏中是正确的。

代码语言:javascript
复制
    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
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-06 16:42:07

其实很简单。

您所需要的只是将您想要共享的准备好的映像放到StreamingAssets文件夹中(如果没有,则在资产文件夹中创建它),并将Application.persistentDataPath更改为Application.streamingAssetsPath

就这样。

代码语言:javascript
复制
#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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23466305

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档