- Home /
Question by
ismailounjif · Sep 01, 2020 at 03:51 PM ·
unity 2dfacebookurlurl schemes
how i can share my screenshot in base64 data to facebook using Unity ??
i want to share screenshot to facebook in unity. when i run my app in facebook instant game and try to share a screenshot i get an error "picture should represent a valid url facebook".
public void Share()
{
StartCoroutine(Run());
}
IEnumerator Run()
{
yield return new WaitForEndOfFrame();
Texture2D tex = new Texture2D(Screen.width, Screen.height);
tex.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
tex.Apply();
string link = "data:image/png;base64," + Convert.ToBase64String(tex.EncodeToPNG());
Application.OpenURL(link);
Debug.Log(new Uri(link).OriginalString);
FB.FeedShare(link: new Uri("https://fb.gg/play/323074382234169"),
picture: new Uri(link),
);
}
Comment