【Unity3d】unity接入sharesdk分享本地图片失败记录
2015-06-10 17:30
471 查看
接入sharesdk时,即将分享的图片如果指向网络里的资源没问题;但是如果改成分享SD卡里的图片,发现分享不了;
错误提示:Texture ‘share' is not readable, the memory can not be accessed form scripts, You can make the texture
readable in the Texture Import Setting。
解决方法来自于http://tieba.baidu.com/p/2770331770;
只需将即将分享的图片放置在Resources目录下,然后按照下面图片所示修改下设置即可:
![](http://img.blog.csdn.net/20150610172017987?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2hpbmFjeXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
附上来自于
momo雨松的部分sharesdk for unity3d 分享源代码,需要的小伙伴自行拷贝:
错误提示:Texture ‘share' is not readable, the memory can not be accessed form scripts, You can make the texture
readable in the Texture Import Setting。
解决方法来自于http://tieba.baidu.com/p/2770331770;
只需将即将分享的图片放置在Resources目录下,然后按照下面图片所示修改下设置即可:
附上来自于
momo雨松的部分sharesdk for unity3d 分享源代码,需要的小伙伴自行拷贝:
//分享的本地图片处理 private void Copy2SDpath() { //读、写的路径 string imagePath = Application.persistentDataPath + "/share.png"; //如果文件不存在,把它拷贝进去。 if (!System.IO.File.Exists(imagePath)) { Texture2D o = Resources.Load("share") as Texture2D; if (o != null) { System.IO.File.WriteAllBytes(imagePath, o.EncodeToPNG()); } } }
private void ShareByAndroid() { Copy2SDpath(); Hashtable content = new Hashtable(); content["content"] = String.Format("周竞演得分{0},名列全球第{1}位,不服来战!来自点点那星星!", iTotalScore, iGlobleNew); //image的路径就可以直接写了。 string imagePath = Application.persistentDataPath + "/share.png"; if (System.IO.File.Exists(imagePath)) { content["image"] = imagePath; } else { content["image"] = "http://120.**.53.223:8765/icon108x108.png"; } content["title"] = "点点那星星,越点越开心"; content["description"] = String.Format("周竞演得分{0},名列全球第{1}位,不服来战!来自点点那星星!", iTotalScore, iGlobleNew); content["url"] = "http://120.**.53.223/"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://120.**.53.223/"; content["site"] = "点点那星星"; content["musicUrl"] = ""; //开启,调用客户端授权 content["disableSSOWhenAuthorize"] = false; content["shareTheme"] = "classic";//ShareTheme has only two value which are skyblue and classic ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareMenu(null, content, 100, 100, MenuArrowDirection.Up, evt); }
相关文章推荐
- Unity5.0.2工程出现的错误处理
- Unity之Bmob云存储一
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系
- [***]在Unity 脚本中的作用 C#
- AddComponent添加脚本后,新添加的脚本的执行顺序
- Unity3D#Unity获取游戏对象详解
- Shader简单例子之挖孔
- [UnityShader]溶解与重现效果
- unity3d移动平台性能优化15:UIGrid优化
- Ubuntu重新安装ubuntu unity
- Unity Mesh 网格合并
- Behavior Designer中节点类型分析
- 非常详细的测试unity与android之间的通讯操作
- unity3d 获取游戏对象详解
- Unityshader实例01:冰块材质
- [Unity3D]再次点击以退出程序
- Unity3D之预设的使用细节【转载】
- Unity 中,FPS 第一人称行走,按A键,一直后退。WASD方向控制错误
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(47)-工作流设计-补充
- Unity3D研究院之打开Activity与调用JAVA代码传递参数(十八)