Native Sharing in Unity – Android Game Developement

Native sharing in unity allows you to share your text and image in the native platform such as android using Unity game engine.Sometimes you want to take a screenshot of your current screen and share it on social media.

native sharing

Unity doesn’t provide a feature for native sharing, thus we have to implement java code into unity to share such thing on social media.

Unity allows you to implement native android code, so we can do it by this Unity’s native features for Android.In Unity, we can create a screenshot by following two ways.

Using Texture2D

Here’s how you can save an image into texture2D and store in memory.

Now save it into persistent data path in unity.

Using Application.CaptureScreenshot

Take screenshot and store in memory directly.

Sharing Screenshot in Android Native using Unity

Setup strings for native sharing

Setting up native android class and object

setup URI class and share screenshot.

Don’t be confused with this…. the following is a full code of the implementation.

Still looking for something?yes, multiplayer, analytics for Facebook integration which makes your game better and user engaged.

Leave a Reply

Your email address will not be published. Required fields are marked *