Unity — ShareSDK 游戏分享图片

ShareSDK 分享游戏截图

准备好工作:
接入ShareSDK,并且接好微信授权,SDK 接入查看官方网站,教程很详细,有什么问题中客服,客服是小兄die还是还有耐心的,折腾了四天,
直接上代码:

    private void OnClickSendFriend()
    {
    	//点击分享的事件
        StartCoroutine(CaptureCoroutine());
    }

    private IEnumerator CaptureCoroutine()
    {
        yield return new WaitForSeconds(0.5f);
        string imagePath = Application.persistentDataPath;
        ScreenCapture.CaptureScreenshot("Screenshot.png");          //截图

        ShareContent content = new ShareContent();
        //content.SetText("大家好");
        content.SetImagePath(imagePath + "/Screenshot.png");
        //content.SetTitle("Victory教育");
        //content.SetComment("这里是victory分享的内容");
        content.SetShareType(ContentType.Image);
        //ssdk.ShowPlatformList(null, content, 100, 100);//分享列表
        Mir.Instance.cData.playerData.shareSDK.ShowShareContentEditor(PlatformType.WeChat, content);
      
    }
发布了37 篇原创文章 · 获赞 11 · 访问量 6167

猜你喜欢

转载自blog.csdn.net/weixin_42422809/article/details/98089013