[英]Sharing screenshot with text to facebook unity
我试图让用户可以通过游戏的下载链接在 facebook 上发布他的游戏截图。
我看了一点,似乎可以使用 FB.API,但我无法让它工作。 Aparently 你需要一个许可,但我无法找到哪个许可以及如何给予它。
我正在使用统一 2020.3.21f1
这是我现在正在做的事情
public void ShareScreenShot(Texture2D screenShot)
{
byte[] encodedScreenShot = screenShot.EncodeToPNG();
var wwwForm = new WWWForm();
wwwForm.AddBinaryData("image", encodedScreenShot, "ScreenShot.png");
wwwForm.AddField("message", "Venez me défier : https://randomlink.blablabla");
FB.API("me/photos", HttpMethod.POST, ShareScreenShotCallback, wwwForm);
}
void ShareScreenShotCallback(IResult result)
{
if (result.Error != null)
{
Debug.Log(result.Error);
}
else
{
Debug.Log("sharing success");
}
}
如果哪位大神知道怎么弄,那将是非常有帮助的,谢谢
我想您需要使用自定义权限登录 facebook,因为默认权限仅允许您向选定的朋友发送邀请。
https://developers.facebook.com/docs/unity/reference/current/FB.LogInWithPublishPermissions/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.