yasirkula / UnityNativeShare

A Unity plugin to natively share files (images, videos, documents, etc.) and/or plain text on Android & iOS
MIT License
890 stars 131 forks source link

Image is not getting shared when shared with Text on some platforms #168

Open harishG2W opened 1 year ago

harishG2W commented 1 year ago

@yasirkula Hi Thanks for the great plugin. I am sharing the image like following but not able to see the image and text together in some selected apps

RenderTexture rt = new RenderTexture(resWidth, resHeight, 24); Camera.main.targetTexture = rt; Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false); Camera.main.Render(); RenderTexture.active = rt; screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0); Camera.main.targetTexture = null; RenderTexture.active = null; // JC: added to avoid errors Destroy(rt); byte[] bytes = screenShot.EncodeToPNG(); string filename = G2WGameConstants.ScreenShotName(resWidth, resHeight); isSharing =true; new NativeShare().AddFile(filename) .SetSubject("Subject").SetText("Sharing text") .SetCallback((result, shareTarget) => isSharing = false ) .Share();

yasirkula commented 1 year ago

That's unfortunately expected:

image